socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
434 stars 138 forks source link

Dynamic Update of Time Slider Extents from Features #57

Open stirringhalo opened 8 years ago

stirringhalo commented 8 years ago

This is a feature request, would it be possible to have an additional URL, perhaps attached to the tileDimensionOptions, with a WFS url, layer name, time_column, etc that would be interpreted for updateTimeDimension? That way, the timeslider would only show the times of what's visible. WFS formats that would be easy to parse are CSVs, or GeoJSON.

My use-case is a whole lot of satellite images, over a very long time series. This is the perfect plugin to use as it has the ability to play through available images. However, if a large satellite archive is used, the time slider isn't really relevant. But if only the images in leaflet display are used to determine the time controller, animations would be very slick and extremely dynamic to the data available. Using WFS seems the simplest way to go about this. I think most of the changes would be around getTimesFromLayerCapabilities, with an additional options added with WFS url, WFS column, and name of WFS layer.

r1m commented 8 years ago

I'm not sure how you want to retreive your times (layer wize or map wize)

For layer level, you can inherit from L.TimeDimension.Layer.GeoJson and override _getFeatureTimes. or L.TimeDimension.Layer.WMS _requestTimeDimensionFromCapabilities

On map level, load your available times with your own ajax request/method and set it to the map with

var times = /*compute your own times */
map.timeDimension.setAvailableTimes(times);

And on each layer set this options

{ 
  requestTimeFromCapabilities : false,
  updateTimeDimension:false
}```