Using Script to update files
Recce
Global Mapper UserTrusted User
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?
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
-
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 -
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? -
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 -
Hi Global_mapper,
is there a possibility to split polylines so that each vertex can be considerate as a single point?
Thanks.global_mapper wrote: »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 -
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
Categories
- 12.9K All Categories
- 5.8K Features Discussion
- 349 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 651 GM Script Language
- 55 User Scripts
- 115 GPS Features
- 420 Projection Questions
- 835 Raster Data
- 1.4K Vector Data
- 6.6K Support
- 181 Announcement and News
- 936 Bug Report
- 561 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 578 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 244 How I use Global Mapper
- 109 Global Mapper Forum Website
