Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a points shapefile that originally came from a GPX file (imported using QGIS). The original GPX file contained waypoints only and has disappeared.

The shapefile has many attributes, but only some have data. Below are these attributes with two example data records (some decimal values discarded to fit onto one row).

  TYPE    IDENT    LAT     LONG      Y_PROJ        X_PROJ          COMMENT
WAYPOINT    JS    -31.6    22.6    -23610488.1    8084542.7    29-AUG-09 13:56
WAYPOINT    PS    -31.6    22.7    -23610333.7    8084487.4    29-AUG-09 14:01

A client of mine would like to convert the shapefile back into GPX, retaining the IDENT attribute as the label for each waypoint; he wants to use the GPX file in Garmin's Basecamp software. I have exported the shapefile sucessfully from both QGIS and ExpertGPS, but when I open the files in Garmin's Basecamp softare, each waypoint has only a sequential number as label.

When I look at the GPX files in a text editor, all the atrribute information is there. For example:

<wpt lat="-31.695305019999999" lon="22.647454610000000">
    <ogr:COMMENT>29-AUG-09 13:56</ogr:COMMENT>

Does anyone know how I could achieve this?

Thanks Hanlie

share|improve this question

You can use ogr2ogr with the -sql option to specify columns equivalence of the shapefile to the gpx.

Here is an example from the ogr documentation:
ogr2ogr -f GPX output.gpx input.shp -sql "SELECT field1 AS name, field2 AS desc FROM input"

share|improve this answer
Thanks, that worked :-) – user3116 Jun 2 '11 at 13:14
Nice, please accept the answer if you wish. (click in the green V button). – Pablo Jun 2 '11 at 13:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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