I am looking for a software that does batch processing of shapefiles to GPX files. I have seen many including Arcmap that will batch gpx to shapefiles but none vice versa. I currently am using DNR Garmin to complete the task one file at a time but it is time consuming.
-
You can use arcmap interoperability extension.– LearnerCommented Jan 22, 2015 at 5:55
-
1If you're already using ArcMap, you could give this a try: arcgis.com/home/item.html?id=067d6ab392b24497b8466eb8447ea7eb– KHibmaCommented Jan 22, 2015 at 18:46
-
The script tool works but the files will not open in Base Camp or Mapsource for some reason. I can still get them to a GPS via other sources but my entire field team uses Garmin products and getting them to switch will be quite the task. I do not have access to the interoperability extension. I have a basic license at work.– S. BurkeCommented Jan 23, 2015 at 21:45
2 Answers
GDAl ogr2ogr should do what you want:
ogr2ogr -f "GPX" -t_srs EPSG:4326 out.gpx in.shp
Note that this will only work for line and point features. Polygons must be converted to lines before.
You can use it for whole directories with a FOR loop depending on your operating system.
For Windows, it should be something like
for %%N in (D:\inputfolder\*.shp) DO ogr2ogr -f "GPX" -dsco "GPX_USE_EXTENSIONS=YES FORCE_GPX_TRACK=YES" -t_srs epsg:4326 D:\outputfolder\%%~nN.gpx %%N
pause
The creation option GPX_USE_EXTENSIONS=YES
is necessary because GPX has only a limited range of allowed field names, compared to the shapefile input. FORCE_GPX_TRACK=YES
will save your input linestrings into tracks instead of routes.
inputfolder and outputfolder might require quotations around if the full path contains blanks.
-
I have not had a chance to explore this solution yet but I will inform you of results when I do.– S. BurkeCommented Jan 23, 2015 at 21:47
Global Mapper will batch convert many formats including .shp to .gpx.
To use it:
- Open Global Mapper (need it installed)
- Go File>Batch Convert/Reproject.
- When the window "Select File Type to Convert From" appears- select Shapefile, click OK.
- When the window "Select File Type to Convert To" appears - select GPX(GPS eXchange Format), click OK.
- When the "Batch Convert" Window opens, add in the files you wish to convert. For the output location, you can specify the same directory or another location to output to. When happy with the settings, click OK.
- The files will then be batched converted to the location you specified in step 5 (top 3 files are the converted shapefile in .gpx format).