Call player functions from outside using WMS tiles
Closed this issue · 3 comments
julste commented
Hi there,
I'm using a WMS tile layer and added it to my map like this:
var map = L.map('map',{
minZoom: 5,
maxZoom: 8,
timeDimension: true,
timeDimensionOptions:{
timeInterval: "PT2H/" + fDate.toISOString(),
period: "PT5M",
currentTime: fDate
},
timeDimensionControl: false,
timeDimensionControlOptions: {
autoPlay: false,
playerOptions: {
buffer: 10,
transitionTime: 500,
loop: true,
}
},
var radarWMS = L.tileLayer.wms('url', {
layers: "name",
transparent: true,
format: "image/png",
opacity: 1,
zIndex:2
});
var testTimeLayer = L.timeDimension.layer.wms(radarWMS, {
updateTimeDimension: false,
wmsVersion: '1.3.0',
cache: 24,
});
testTimeLayer.addTo(map);
Then added also a custom player like this:
var player = new L.TimeDimension.Player({}, map.timeDimension);
Unfortunately it is not possible to call the start, stop functions from the player object:
player.start()
Using a custom time dimension instead works well:
var timeDimensionControl = new L.Control.TimeDimensionCustom({
autoPlay: false,
playerOptions: {
buffer: 100,
transitionTime: 500,
loop: true,
}
});
map.addControl(this.timeDimensionControl);
My question is: Is it possible to call the player functions from outside using a WMS tile layer?
Thanks in advance!
r1m commented
You need to add the player to your control.
var timeDimensionControl = new L.Control.TimeDimensionCustom({
autoPlay: false,
player: player
});
julste commented
Thanks for the fast reply!
It works now :)
But how can I hide the player control then?
julste commented
Never mind, I had just to comment out the timeDimensionControl.
Thank you very much