pdhoopr / gps-to-gpx

A simple tool that uses GPS waypoint data to generate GPX.
https://npm.im/gps-to-gpx
MIT License
25 stars 8 forks source link

GPX 1.0 vs 1.1 #11

Open Phyks opened 5 years ago

Phyks commented 5 years ago

Hi,

Actually, I've just noticed the current version of the lib output a GPX 1.1 file (which is latest version). This is perfectly fine and works well except for the recently added course field. Actually, course is defined in GPX 1.0 spec: http://www.topografix.com/gpx_manual.asp.

However, it seems to have disappeared from the GPX 1.1 spec: https://www.topografix.com/gpx/1/1/.

Not sure what is best to do here, either:

Best,

pdhoopr commented 5 years ago

Good catch! Actually, looking at the schema, both course and speed are no longer standard in GPX 1.1. However, v2 of Garmin's trackpoint extensions schema allow for both elements to be included as extensions. So, I think the best approach is the following:

The ability to pass trackpoint extensions to the library already exists, so there shouldn't be anything else needed there. When using the library, though, you should update your code to pass course and speed as extensions instead.

GPX schemas The following namespace/schema attributes should be set on the opening <gpx> tag as follows:

Would you like to open a PR implementing these changes? If not, I'll take care of them when I have a chance.

pdhoopr commented 5 years ago

Actually, since the course and speed elements have been released, I'd consider it a breaking change to remove them, even if they aren't valid. Let's leave them for now and log a deprecation message when a user passes the courseKey or speedKey. The message should alert them that these elements aren't valid in GPX 1.1, that they should switch to using them as extensions instead, and that they will be removed in a future release.