tkrajina / gpxpy

gpx-py is a python GPX parser. GPX (GPS eXchange Format) is an XML based file format for GPS tracks.
Apache License 2.0
993 stars 223 forks source link

GPXInfo JSON output #132

Closed demlak closed 4 years ago

demlak commented 6 years ago

Hi, first: i'm not a coder =)

for a project i need json output for gpxinfo. with much trial and error, i made it working for me. Maybe this could help someone else. Maybe this will get into release?

again: i'm not a coder =) this code is probably crap and maybe also malfunction on a usecase that i did not check.

since i did not know how to solve some things, i was adding the "end" "true" lines to solve some issues with commas.

well.. did i say that i'm not a coder? =) the result is attached. gpxinfojson.zip

tkrajina commented 6 years ago

When I started gpxinfo, it was just tool for testing gpxpy. It looks like more and more people are using it now... If enough people agree about this, I'll add it.

BTW, if the name of the gpx file contains a " character your implementation will create an invalid JSON file.

A better way would be something like this: https://github.com/tkrajina/gpxpy/commit/c2cc6097de3c33d5826eba4c527f7699beb51d78 (this is just an idea, not a complete implementation)