makinacorpus / Leaflet.FileLayer

Loads files locally (GeoJSON, KML, GPX) as layers using HTML5 File API
http://makinacorpus.github.io/Leaflet.FileLayer/
MIT License
270 stars 91 forks source link

Handle more GPX data #20

Open Wilkins opened 8 years ago

Wilkins commented 8 years ago

On one of my project, I'm trying to load a GPX file with "extra" gpx data, like :

Unfortunately, when loading the GPX file, that data seems lost because the GeoJSON format doesn't handle it. Is there any way to retrieve that data ? Maybe the GPX parser that is used doesn't support that extra data but it could be kept anyway ?

Here is a GPX sample file with that extra data : http://wilkins.fr/gpx-sample/bangalore.gpx

Willing to help. Thanks.

stefanocudini commented 8 years ago

+1

leplatrem commented 8 years ago

Thanks for your feedback !

GeoJSON is compatible with what you describe, since it can store any data as a property. You are right, so far, there is no way to specify the properties being read from GPX.

I could not dig as much as I could, but it looks like togeojson has a fixed list of properties when the GPX file is read.

You could first try to fork it and use your own, with your the properties you'd like to be parsed. Then you can try to submit a patch there (either adding those extra data names, if they are standard enough, or adding a way to specify custom ones if they are exotic)


We would welcome any help for maintaining this library. If you use it and find it useful, please Watch it on Github, help us review contributions or comment issues :) Thousand thanks in advance.

SBats commented 7 years ago

Hi @Wilkins and @stefanocudini ! Thank you for the feedback. I'm cleaning and improving a bit this plugin. Is this issue still relevant ? I guess you've fixed it in your case by using a forked version of toGeoJSON library ? We were thinking about giving the option of passing custom parsers instead of directly relying on toGeojson, but it's not a simple development so I'm not sure we'ill do this soon. Please leet me know about your situation with this plugin :)