Leaflet.TimeDimension icon indicating copy to clipboard operation
Leaflet.TimeDimension copied to clipboard

Animate non WMS layer?

Open kseniya292 opened this issue 6 years ago • 6 comments

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?

kseniya292 avatar May 29 '18 02:05 kseniya292

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

pazrg avatar Jun 01 '18 06:06 pazrg

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

r1m avatar Jun 01 '18 12:06 r1m

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 avatar Mar 28 '20 06:03 Rishabh570

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 avatar Mar 28 '20 07:03 Rishabh570

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

Thanks!!!

Rishabh570 avatar Mar 29 '20 04:03 Rishabh570

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)

bielfrontera avatar Mar 30 '20 11:03 bielfrontera