hallahan / LeafletPlayback

This is a Leaflet plug-in that plays back points that have a time stamp synchronized to a clock.
http://leafletplayback.theoutpost.io
Other
482 stars 166 forks source link

Support ISO8601 times #7

Open srstsavage opened 10 years ago

srstsavage commented 10 years ago

Unless I missed something, it seems like only Unix timestamps are supported for now. It would be useful to also support ISO8601 timestamps, e.g. "2014-02-11T10:22:46Z".

hallahan commented 10 years ago

I encode in the GeoJSON Unix timestamp because it is the most compact and efficient way to measure time. If you want to convert a unix timestamp to ISO:

var s = new Date(1331209044000).toISOString();

and ISO to Unix timestamp:

var t = new Date("2014-02-11T10:22:46Z").getTime()

Could you give me some background for what you would like to use LeafletPlayback for? That way I could figure out how to add these features you need.

srstsavage commented 10 years ago

There's an existing geojson format (ObsJSON) that appears to be compatile with LeaftletPlayback's format other than the ISO8601 times. Maybe when a geoJSON track is loaded jQuery's $.isNumeric() could look at time[0] and if needed process the times through a conversion method before continuing. Just a thought, but it would be nice to be able to pass in this existing format.

hallahan commented 10 years ago

Very cool! I didn't know about this. Looks like I think alike to these guys. I'll add support. Stand by...