3

Running QGIS 2.10.1 on Ubuntu 14.04 x64.

Going to add a column to the attribute table (GPX layer) but couldn't select any type. Then, failed - "Failed to add field 'NameTest' of type. Is the field name unique?".

Need to provide types firstly before adding a column? How to set it?

Add column to attribute table


Reference
https://docs.qgis.org/2.2/en/docs/training_manual/create_vector_data/actions.html

6
  1. You can't modify GPX data in QGIS. Though GDAL supports GPX writing, this support is limited to creation only, modification of existing files is not supported.
  2. Moreover, GPX is a format with specific structure, so you can't just add ANY field to it unless you use Extensions, but again, QGIS doesn't support this either.

You might want to save as ESRI Shape before doing any modifications.

In any case, your QGIS shouldn't allow you to even start editing GPX (mine doesn't), if it does, you might've encountered a bug.

  • You can add a GPX layer by using Add Vector Layer or with the GPS Tools. The first adds the layer read-only, while the second has the behaviour as described in the question. It is not a bug, just the limited writing capabilities of the driver. – AndreJ Oct 19 '15 at 5:09
2

You can use a workaround for individual components of the GPX file (waypoints, track points, etc), but as @Maxim notes you can't edit a GPX file directly as you would a shapefile.

  1. Reproject the GPX layer using Processing, creating a temporary memory layer;
  2. Edit the new layer, adding columns or changing features as necessary;
  3. Save-as a GPX file, using the GPX_USE_EXTENSIONS=yes option.

Reproject

Open the Processing toolbox (or use the Commander (it has a hotkey, opt-cmd-M on my Mac)) and search for and open 'reproject'.

Keep the [Save to temporary file] option to make a memory layer, and don't actually change the CRS.

Add columns, edit this new layer as necessary, then save-as a GPX again, remembering to keep the GPX_EXTENSIONS option as shown, and keep the CRS as 4326:

You'll get a GPX file but it will have an 'extensions' tag for each waypoint, with the new column names and their values.

NOTE: many applications ignore the extensions tag or mangle it, so you may find your data disappearing!

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.