2

I have some waypoint layers that contain different types of points and I distinguish these in QGIS by different symbols and colours. I want to export these to a GPX file that I can download to my GPS but The GPX file contains just the lat, long and the 'type'.

Is there a way of getting gpstool to save other attributes in a gpx file?

I do get some more data out in (gid, source and classification) so I can write a script to process the xml and add the necessary attributes that the GPS expects.

Secondary question: Would this make a useful plugin?

1
  • 1
    the answer above seems good - the "<name>Push Log Point #1</name>" format to include in a GPX file is correct, you have to know what symbol names the destination device will recognize. It also opens up an issue I find frustrating and maybe someone can comment - Using Garmin Basecamp I can export a waypoints GPX file (with names formatted as above) to a Garmin Montana 680T and it retains the symbols that it recognizes. However, on other devices - The Hema HX1 import process turns everything into a blue flag (despite extensive testing of possible/plausible symbol names, or even null values). The
    – Tim
    Commented Mar 27, 2021 at 2:22

1 Answer 1

2

Using pure GDAL, you can preserve the waypoint symbol and type of an original GPX file with

ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES out.gpx in.gpx waypoints

<wpt lat="51.295094" lon="6.790674">
  <ele>39.0</ele>
  <time>2014-10-14T13:56:58Z</time>
  <name>Push Log Point #1</name>
  <desc>Lat.=51.295094, Long.=6.790674, Alt.=39.000000m, Speed=3Km/h, Course=45deg.</desc>
  <sym>Waypoint</sym>
  <type>Other</type>
  <extensions>
    <label><label_text>Push Log Point #1</label_text></label>
  </extensions>
</wpt>

So if you have a shapefile in QGIS, create columns with names sym and type and export it to GPX format with GPX_USE_EXTENSIONS=YES (which is default for GPX since QGIS 2.4).

Remember to save into EPSG:4326, as GPX only allows that.

Other features (like label) will be exported in the <extensions> element, and probably ignored by a GPS unit. My output reads as follows:

<wpt lat="51.295094" lon="6.790674">
  <name>Push Log Point #1</name>
  <sym>Waypoint</sym>
  <type>Other</type>
  <extensions>
    <ogr:elevation>39.0</ogr:elevation>
    <ogr:label>1</ogr:label>
  </extensions>
</wpt>
<wpt lat="51.295091" lon="6.790663">
  <name>Push Log Point #2</name>
  <sym>church</sym>
  <type>tower</type>
  <extensions>
    <ogr:elevation>38.0</ogr:elevation>
    <ogr:label>2</ogr:label>
  </extensions>
</wpt>

The available symbols depend on the GPS units, so you might create a sample GPX file with the unit and test all available symbols. These will not be imported into QGIS, but you can read the file with a text editor.

As an example, symbols of the Garmin Oregon 6xx are listed at this site. You can even create your own symbols and upload them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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