placemark / togeojson

convert KML, TCX, and GPX to GeoJSON, without the fuss
https://placemark.github.io/togeojson/
BSD 2-Clause "Simplified" License
401 stars 67 forks source link

Reason for not mapping all found TrackPointExtensions, and only keeping one? #124

Open nanoandrew4 opened 6 months ago

nanoandrew4 commented 6 months ago

Hello, I was testing this library with some of my Garmin GPX files that include HR, cadence and temperature data in them, but I saw that only one of these data sequences is included in the output FeatureCollection. From reading the GeoJson spec, it seems the properties member cannot be an array, but it could contain a map with the key being the tag name (such as hr, cad, etc...), and the value being the data sequence, could it not? That way the data can be manipulated later, and it is tagged in some way, since currently you have no idea what the data sequence represents, it has no label. If performance or memory were a concern, perhaps an optional flag could be used to parse all extensions?

tmcw commented 6 months ago

Can you be a little more precise and maybe give an input file and an output file? This tool already parses all valid extensions under the Gpx namespace and includes all of them in feature properties.

nanoandrew4 commented 6 months ago

I think the problem is that the tool is accounting for the Garmin GpxExtensions, but not the Garmin TrackPointExtension, either because it is something new or was intentionally ignored or handled the way it is by design, hence why I thought I'd open an issue to ask.

The XML schema URL for the namespace that is not handled as I expected is the following: http://www.garmin.com/xmlschemas/TrackPointExtension/v1. I have added one of my files here, hopefully the download link works. The data that is being read partially is with the ns3 namespace. The output looks as follows in my browser console: image

You'll see that in the case of this file, it is deciding to read the atemp data, and ignores both HR and cadence. In my running and cycling activities, it prefers the HR data over the cadence, for example, but the data is not tagged in the output file in any way, just stored as an array of values with no indication of what it is holding.