# Converting .shp into .gpx using QGIS

I would like to convert .shp into .gpx.

Using GIS, I open my shapefile and I tried to "save as" gpx but it gives an OGR error:

creation of field ObjectId failed (OGR error: Field of name 'ObjectId' is not supported in GPX schema. Use GPX_USE_EXTENSIONS creation option to allow use of the element).

How can I fix this error?

• I tried this in another PC with the same OS and it works! Andre Joost is correct! I still dont know why this works here and doesn't work in the other PC. Should i install GPX driver?? :| Thanks André Joost! Nov 12 '12 at 9:16
• in a situation like that, where the error mentions a parameter or setting you're not familiar with, check the related GDAL or OGR formats page for the driver you're using, e.g. GPX. In some scenarios, you won't want to blindly apply an option as it might hurt your data. Case-in-point, you would not want to indiscriminantly apply -skipfailures in ogr2ogr without researching why it's failing in the first place. Dec 6 '12 at 17:18

Just do what you are told: In the Data source field, enter

GPX_USE_EXTENSIONS=YES


or check "skip attribute creation" underneath (or what it is named in your language).

In the Layer field, you might also enter

FORCE_GPX_TRACK=YES


to get tracks instead of routes.

• Thanks, it really works, but when i convert shp to gpx i lost my Id field. All my gpx fields are null. How can i correspond my "id" field(shp file) to "name" field(gpx file). Nov 9 '12 at 14:26
• I'm afraid this is not possible on exporting. it is possible with ogr2ogr.exe from the gdal package: ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=NO shpexport.gpx D:\path\to\your\test.shp -lco FORCE_GPX_TRACK=YES -sql "SELECT id AS name FROM layername" Nov 9 '12 at 15:55
• You can use the table manager plugin to rename the id field in the shapefile to "name" before exporting and change it back afterwards. If necessary, you have to add pyqgis.org/repo/contributed to the list of your repositories. Nov 10 '12 at 6:15
• i tried to rename the id field in shapefile to name before exporting but doesn't work. i look for an application that add an python app named PostGPS, but doesn't work. I tried with ogr2ogr using your script too without success :/ Am i doing something wrong. There is any other possible sollution? Nov 11 '12 at 19:45
• Strange, it worked here. You have to set "GPX_USE_EXTENSIONS=YES" in the upper field of the Save As dialogue. With the checkbox it does not work. For the ogr2ogr, you have to use the layername, not necessary the same as the shapefiles name. Nov 11 '12 at 20:36

One simple trick worked for us. In the main csv file, the first field (ID/ label) should be named 'name'. and then import that file and save as .gpx

• Thanks for this - for any lurkers, this is the answer to get your pesky .gpx points to be named what you want! Apr 27 at 1:01

Alternatively, you can try the following steps:

1. Open your SHP file with QGIS
2. Select your SHP layer
3. Layer > Save as... > GPX

You can also use DNRGarmin from the Minnisota department of Natural Resources. It's a free tool and allows you to do a lot of imports and exports for GPS data

You can force:

GPX_USE_EXTENSIONS=YES


As indicated above. However, if you don't understand or manage your projections, then you will run into additional problems. You will find errors in the data - imprecision in the points or tracks if your CRS is different from what your shapefiles are projected in or how your workspace is projected; WGS84 is needed for GPS units.

The best solution I have found is to select "Reproject layer" from your processing toolbox. This gives you the option to batch convert multiple layers, reproject the data properly, and save as a gpx file.

The only issue that I haven't learned to solve is how to retain the labels. I'm hoping that someone might know how or have a trick to do this - it doesn't seem to be an option. I have had to either use the clunky Garmin BaseCamp software to click and revise the labels individually or go into the gpx code and type in the code manually - both are time consuming.