5

I have some point data in PostgreSQL / PostGIS. How do I export the data to a GPX file? I looked for commands similar to ST_AsGML and ST_AsKML but could not find anything to convert to GPX (like a ST_AsGPX).

  • GPX is an XML format similar to KML or GML but not the same. Utilities from GPS manufacturers (like Garmin etc.) can import shapefiles into GPX format but that can be a bit expensive. There is a site topografix.com/gpx.asp that might be able to help. I would say most of the time users want GPX -> SDE rather than SDE -> GPX which would be why it's so hard to find a utility. – Michael Stimson Apr 2 '15 at 1:20
  • see postgis to line (gpx) using QGIS gis.stackexchange.com/questions/65217/… – Mapperz Apr 2 '15 at 14:33
5

Not quite in PostGIS but you should be able to extract it using ogr2ogr's GPX driver

ogr2ogr -f GPX points.gpx PG:'host=your_server user=your_username dbname=your_database'

http://www.gdal.org/drv_gpx.html

2

You can also use DNRGPS to convert from PostgreSQL to GPX. Great utility.

enter image description here

0

The GPX format is a standard text tag format and so can be built as a text file manually or with code if necessary. Most spatial software (if you have access to it: QGIS, ArcGIS, Global Mapper etc) will have utilities to simplify the conversion from a file or feature class to GPX in some form. Depending on how you wish to build your GPX file (track points vs way points etc) and device you wish to load it on it might be easier to get the desired result by using a bulk export utility (like those mentioned above) and then edit the text tags of the resulting GPX file.

Sometimes a combined approach is the only way to get exactly what you need. The specification link will give you all the tag references.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.