socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
435 stars 139 forks source link

Animate non WMS layer? #150

Open kseniya292 opened 6 years ago

kseniya292 commented 6 years ago

Hello. I'm new to weather mapping. I'm working on an application where users can select layers and animate them. In all of the examples, timeDimension is being added to a WMS layer. I'm grabbing my layers using getGTile. Is it possible to use timeDimesion for non WMS tiles?

pazrg commented 6 years ago

Hi @kseniya292 , I am afraid that the current version of timeDimension is only able to work with WMS and geoJson layers. Maybe you can do some hacking so it includes another posible implementation of a time dimension layer apart form WMS (L.TimeDimension.Layer.WMS) and geoJson (L.TimeDimension.Layer.GeoJSON) based on the leaflet.TileLayer.WMTS leaflet plugin specifications (https://github.com/mylen/leaflet.TileLayer.WMTS) or leaflet.projwmts (https://github.com/GeoportalPL/leaflet.projwmts) but I have never tried it to be honest. Hope this helps!, Paz rg

r1m commented 6 years ago

You can extend the use any layer implementation that can produce a timed layer.

var layer= MyLayer(...);
var timedLayer = new L.TimeDimesion.WMS(layer);

Your layer will be recreated for each time with a different time parameter. You will need to provide your own times using setAvailableTimes.

Or you can create your own timelayer based on example 10

Rishabh570 commented 4 years ago

Hi @r1m, Can I make a time layer from a layerGroup as well.? Actually I have some custom layerGroups which are used as overlays and I want to convert those into a time dimension layers. Any help is highly appreciated. :raised_hands:

Thanks!!!

Rishabh570 commented 4 years ago

This is one of those layerGroups,

Screenshot from 2020-03-28 12-27-39

and I'm using it in my main js file as,

let AQICNLayer = L.layerGroup.aqicnLayer();

and then, I put this AQICNLayer into my overlapMap like this,

let overlapMap = {
    "aqicnLayer": AQICNLayer,
};

and then I use it in L.control.layers(baseMaps, overlayMaps).addTo(map);

Please let me know how can I convert these into time Dimension ones. Thanks!!!

Rishabh570 commented 4 years ago

@bielfrontera Can you please take a look? I am not able to figure it out.

Thanks!!!

bielfrontera commented 4 years ago

Hi @Rishabh570, you can add a timedimension layer to a LayerGroup. It would behave as any other kind of layer. I mean, you do not have to adapt the LayerGroup but the layers you add to it.

(btw, it would be better to open a new issue rather than comment here)