Using Script to update files

Recce
Recce Global Mapper UserTrusted User
edited April 2008 in Vector Data
Hi all!

I made this script to convert GPX to SHP files.

GLOBAL_MAPPER_SCRIPT VERSION=1.00

UNLOAD_ALL

IMPORT FILENAME="c:\garmin\MapSource2FV\MapSource GPX file.gpx" TYPE=GPX

EXPORT_VECTOR FILENAME="c:\garmin\MapSource2FV\MapSource2FV_Lines.shp" TYPE=SHAPEFILE SHAPE_TYPE=LINES

EXPORT_VECTOR FILENAME="c:\garmin\MapSource2FV\MapSource2FV_Points.shp" TYPE=SHAPEFILE SHAPE_TYPE=POINTS

Sometimes the GPX file consist of only Points an sometimes mixed Lines and Points.

The problem is when only Points are in the GPX file. Then the Line SHP is still present from an old GPX file.

How to remove the old SHP files in the folder automatically before the new SHP are created?

Comments

  • global_mapper
    global_mapper Administrator
    edited April 2008
    There is not a way to do this from a script, but if you are calling this from the command line or something, just make a batch file (.bat) that first deletes all of the SHP (and accompanying files), like 'del c:\garmin\MapSource2FV\MapSource2FV*.*', then call Global Mapper with the script.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Recce
    Recce Global Mapper User Trusted User
    edited April 2008
    Thank you global_mapper!



    Is it possible to make an empty SHP file instead of deleting it?


    How to start a script using a BAT file?
  • global_mapper
    global_mapper Administrator
    edited April 2008
    There is not currently any way to create an empty SHP file, the export will always immediately abort if no data is available.

    To start a script from a batch file, just add a line to it like the following:

    global_mapper9.exe my_script_name.gms

    Of course you might want to pass the full path to the script and .exe file if they are not in your path.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Sebas80
    Sebas80 Global Mapper User
    edited April 2008
    Hi Global_mapper,
    is there a possibility to split polylines so that each vertex can be considerate as a single point?
    Thanks.
    There is not currently any way to create an empty SHP file, the export will always immediately abort if no data is available.

    To start a script from a batch file, just add a line to it like the following:

    global_mapper9.exe my_script_name.gms

    Of course you might want to pass the full path to the script and .exe file if they are not in your path.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited April 2008
    You could do this by exporting the polylines to a simple ASCII text file, then load that back in using the "Point Only" import option. That should give you a separate point for each vertex in the original polylines.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com