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.
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.
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).