Using the GDAL/OGR command line, how could one add some fields to a GPX file ?
I simply need to add the gpx filename to its content, e.g. in a new field called datasource
in each (there are several in a file):
<?xml version="1.0"?>
<gpx version="1.1" creator="GDAL 3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogr="http://osgeo.org/gdal" 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="41.300000000000003" minlon="10.900000000000000" maxlat="69.700000000000000" maxlon="31.000000000000000"/></metadata>
<trk>
<name>001: Test layer 1</name>
<desc>Layer one</desc>
<!-- I want to add the following 3 lines: -->
<extensions>
<ogr:datasource>GPX_Filename</ogr:datasource>
</extensions>
<trkseg>
...
</trkseg>
</trk>
<trk>
<name>002 Test layer 2</name>
<desc>Layer two</desc>
<!-- I want to add the following 3 lines: -->
<extensions>
<ogr:datasource>GPX_Filename</ogr:datasource>
</extensions>
<trkseg>
...
</trkseg>
</trk>
...
</gpx>
How would can I automate this using the command line (on Linux) ?
GDAL version: GDAL 3.4.1, released 2021/12/27