socib / Leaflet.TimeDimension

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

getCapabilitiesLayerName Not Working #193

Open bambryan opened 4 years ago

bambryan commented 4 years ago

I am trying to use time dimension to load a WMS layer with multiple layers (layers: 'World:layer1,World:layer2,World:layer3,World:layer4') in one request. The problem is the time dimension isn't working cause of the multiple layers so I tried to use getCapabilitiesLayerName: World:layer1 and pull the time from that one layer but it's not working. I have searched through the code and doesn't seem like it is implemented anymore. I don't see anywhere where the alternate layer name variable is used beyond the pull from the declaration.

r1m commented 4 years ago

Can you describe your problem, with a reproductible code snippet ?

If you use L.TileLayer.WMS, the timedimension layer will use exactly the same parameters than the template layer (layers, bbox, styles,...). It will only add a time parameter to the queries.

Available times are computed based on a GetCapabilities request. Did you check the result of this request with layers=World:layer1,World:layer2,... ?

If you want the code that create a new timed version of the layer : see _createLayerForTime

The method you want to look for may be _getTimesFromLayerCapabilities

bambryan commented 4 years ago

The GetCapabilities shows both layers having a time parameter. If I do them individually it works just fine. I thought I could just use the alternate layer name variable to tell the script to just grab one of the layers for time dimension like I did with the alternate url but again it doesn't look like that variable is used or can be used at all.

var radarWMS = L.tileLayer.wms(gwcUrl, { layers: 'World:rain,World:snow', transparent: true, opacity: 0.8 });

var radarTD = L.timeDimension.layer.wms(radarWMS, { getCapabilitiesUrl: wmsUrl, getCapabilitiesLayerName: 'World:rain', proxy: proxy, wmsVersion: '1.3.0' });