0

I have a vector layer that contains multiple attributes that I want to export as individual GPX files. In this instance, the "Save Features As" option exports all of these attributes as 1 GPX file that includes all the attributes. However, I need multiple gpx files that contain one attribute per file.

I try to use the Split Vector Layer tool/script but when I export to GPX (using the bulk processing) I get the result that the split failed because I need to turn on the GPX extensions.

Error Message: Creation of field id failed(OGR error: Field of name 'id' is not supported in GPX schema. Use GPX_USE_EXTENSIONS creation option to allow us of the element.)

How can I turn on the ability to use GPX extensions when using this script?

Image below for reference.

enter image description here

3
  • Welcome to GIS SE. As a new user, please take the Tour. Please Edit the question to contain the error message as text -- images may not be legible on all devices, and their text can't be searched by others looking to find this Question.
    – Vince
    Jun 30, 2021 at 19:14
  • 1
    Split Vector Layer only saving geopackage > github.com/qgis/QGIS/issues/29522
    – Mapperz
    Jun 30, 2021 at 19:21
  • You might get some ideas here: gis.stackexchange.com/questions/40731/….
    – John
    Mar 23, 2023 at 13:51

1 Answer 1

0

I would go the alternative way using GDAL to do some scripting. Be aware I'm using bash because working on a Linux machine. I suppose you can do something similar on Windows machine with enough Powershell knowledge (to remove first line in CSV, see https://stackoverflow.com/questions/2074271/remove-top-line-of-text-file-with-powershell)

# Get unique list to CSV file
ogr2ogr -f CSV out.csv input.shp -sql "SELECT unique_colum FROM input"
# tail is to remove header first line
# Then, we loop other each unique_column value to generate each GPX file
for i in $(tail -n +2 out.csv);
  do ogr2ogr -f GPX  -dsco GPX_USE_EXTENSIONS=YES "output_"$i".gpx" -sql "SELECT * FROM input WHERE unique_colum = '"$i"'";
done;

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.