Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a linestring in a vector layer in QGIS. How can I expot/save this linestring as a GPX file?

I tried to select the linestring, then right click on the vector layer and choose "Save selection as..." and then I choosed GPX format and saved it. But I got this error message:

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

The GPX file is created, but it contains no coordinates. Is there any settings I should do to avoid this error?

How can I export a linestring to a GPX file in QGIS?

share|improve this question

2 Answers 2

The GPX format does support only a defined list of attributes, so if your vector has any attribute that does not match what the specifications say, you'll get that error.

When you export a vector to a gpx don't expect to have necessarily attributes with the coordinates, nevertheless they are present in the gpx file, example (obtained with QGIS):

<?xml version="1.0"?>
<gpx version="1.1" creator="GDAL 1.7.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata><bounds minlat="-0.406488549618321" minlon="-1.158778625954199" maxlat="0.674427480916031" maxlon="1.520610687022901"/></metadata>                    
<rte>
  <name>um</name>
  <rtept lat="0.660687022900763" lon="-1.158778625954199">
  </rtept>
  <rtept lat="0.674427480916031" lon="-0.409923664122138">
  </rtept>
  <rtept lat="-0.001145038167939" lon="-0.041221374045802">
  </rtept>
  <rtept lat="-0.406488549618321" lon="0.453435114503817">
  </rtept>
  <rtept lat="0.239312977099237" lon="1.520610687022901">
  </rtept>
</rte>
</gpx>

More:

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

share|improve this answer
1  
How can I remove the incompatible attributes? e.g. code_06 –  Jonas Oct 17 '11 at 18:03
    
if your vector is a shapefile then make a copy of the vector and then use the "table manager" plugin do delete columns. –  Giovanni Manghi Oct 17 '11 at 18:19
    
I can't find a plugin called "table manager" in QGIS Plugin Manager. Any ideas where I can find this plugin? –  Jonas Oct 17 '11 at 19:45
    
In the menu "plugins" click on "fetch python plugins", then add the 3rd party repositories. Eventually set the plugin installer (this is how this tool is called) to show also the "experimental" plugins. Then just filter the plugin by name, select it and click on "install". –  Giovanni Manghi Oct 17 '11 at 21:40
1  
"Table Manager" allow me to remove the fields. But a new field FID is created all the time. Now I get the same error message but with this field. –  Jonas Oct 17 '11 at 22:04
up vote 3 down vote accepted

When choosing "Save selection as..." and the dialog Save vector layer as... shows up and I select GPX as format, I also have to check

[x] Skip attribute creation

then the GPX file is generated without any problems.

share|improve this answer
1  
I found it very hard to export a gpx file until I unchecked to export attributes box. Thankyou for your advice. However I would like to know which attributes are supported by the GPX export function. Could you make the answer simple such as for tracks, the following field names are good (Name, Elevation etc). I have read the gpx spec, but am not yet at the point where I can figure out how field names correspond to elements in the xml hierarchy. –  user5585 Jan 23 '12 at 0:33

Your Answer

 
discard

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.