skeate / Leaflet.timeline

Display arbitrary GeoJSON on a map with a timeline slider and play button
https://skeate.github.io/Leaflet.timeline
ISC License
388 stars 67 forks source link

Display of current date and list sorting #162

Open barney2074 opened 3 years ago

barney2074 commented 3 years ago

Hello,

loving this plugin If anyone can help me with the following questions, I'd be very grateful:

  1. How can I display the 'current' date outside of the timeline control? It's good having it next to the slider, but I'd like it to be more prominent and placed elsewhere on the page

  2. If I'm using a sidebar list of currently displayed features (as per the earthquakes sample), how would I sort these based on a particular attribute ? So relating to this to the earthquakes, they might be sorted by magnitude (quake.properties.mag)

thank you

Andrew

skeate commented 3 years ago
  1. The current time is available as a property on the timeline control, time. You can see this in the borders example -- open up the dev console and type in timelineControl.time. However, this isn't set until the control has at least one timeline assigned to it.

  2. The code to show that list is here -- essentially you could just sort displayed using (e.g.) lodash's sortBy

barney2074 commented 3 years ago

thanks Jonathon

I've got the current time working without too much trouble The lodash documentation is a bit confusing (to me at least) so I'll have to tinker around with it

Andrew