mapbox / leaflet-omnivore

universal format parser for Leaflet & Mapbox.js
https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-gpx/
Other
651 stars 126 forks source link

Timestamps not supported? #31

Closed karl-petter closed 10 years ago

karl-petter commented 10 years ago

I use leaflet and leaflet-omnivore to present a GPX track on a map along with photos taken along the track. Now I'm working on an animation along the track in-between the photos. To decide where along the track a photo is taken I planned to use the timestamps both in the photos and the track but I realised when importing the GPX the resulting GeoJSON does not include all the timestamps, just the first timestamp of the whole track.

My GPX file results in a LineString and when looking into the code(here) it only reads the first timestamp. Though there are other Leaflet plugins like Leaflet-Playback which instead uses an array of timestamps(see here).

When reading up on GeoJSON it seems not to define how timestamps are expected to be treated. Is there any reason why leaflet-omnivore does not create an array of timestamps but rather just take the first?

tmcw commented 10 years ago

This is a spec-level concern - toGeoJSON can parse timestamps along lines, but has no standard way to encode them in GeoJSON: relevant discussion here. LeafletPlayback uses a convention, not any part of the GeoJSON spec, to provide this functionality, and I am not looking to implement non-standardized data.

dret commented 10 years ago

https://github.com/geojson/draft-geojson/issues/57 may be relevant for this (i just googled this thread here). so the question is two-fold: are non-numbers allowed, and if so, how to represent a timestamp? i think there could be a way to represent well-known extensions (https://github.com/geojson/draft-geojson/issues/56), but that's not something that's currently specified.