openstreetmap / merkaartor

Home of Merkaartor, an openstreetmap mapping program.
http://merkaartor.be/
Other
290 stars 79 forks source link

waypoint/trackpoint elevation not stored #274

Open fkv1 opened 1 year ago

fkv1 commented 1 year ago

Menu "File" -> "Save as..." does not store the elevation (ele tag) of waypoints and trackpoints from imported GPX files into the .mdc file. This is not crucial (the GPX file can be imported again), and the removal of the elevations saves a tiny amount of disk space, but I don't believe it happens on purpose. It rather looks like a bug.

Krakonos commented 3 hours ago

This is a bug.

The cause is the TrackNode inherits from the generic Node class and adds the elevation property. But since it's not a tag in the sense of OSM, it is handled separately (in a similar fashing as coordinates are). Saving should not be a problem, implementing the proper toXML() method will take care of it. Reading it back will be a bit challenging, since it is currently squished with a regular node. The file format will likely have to be extended. Other option is to include the elevation as a special tag, but that would require some magic to convert all nodes with this tag to a TrackNode instances.

None of that is too difficult, but will possibly break compatibility. I may give it a try, but also if someone wants to pickup the task, I'd be happy to merge a PR. I suggest to: