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

TimeDimension AND Velocity

Open xelaboy opened this issue 6 years ago • 7 comments

Hello. I'm new around here and I'd like to know if it's possible to use TimeDimension with Velocity (https://github.com/danwild/leaflet-velocity). I mean, once I get the Velocity layer working, it would be possible to add this layer to the TimeDimension so that I get a time control to vizualize/animate the Velocity layer? I'm trying to use something like this, but without success:

velocityLayer.addTo(mymap);
velocityLayerX = L.timeDimension.layer(velocityLayer, {});
velocityLayerX.addTo(mymap);

Any help will be very apreciated. Thanks much.

xelaboy avatar Mar 26 '18 04:03 xelaboy

https://weacast.gitbooks.io/weacast-docs/content/api/LAYERS.html#flowlayer-source

r1m avatar Jun 03 '18 17:06 r1m

Hi @xelaboy, Did you find any solution for this?

k3bra avatar Mar 20 '19 13:03 k3bra

For now what I'm doing is listening for the event timeloading and update the velocity. Something like this:

map.timeDimension.on('timeloading', function (data) { if (data.time == map.timeDimension.getCurrentTime()) { axios.get('/wind', { params: { time: data.time}).then(function (result) { velocityLayer.setData(result.data) }); } });

k3bra avatar Mar 20 '19 16:03 k3bra

For now what I'm doing is listening for the event timeloading and update the velocity. Something like this:

map.timeDimension.on('timeloading', function (data) { if (data.time == map.timeDimension.getCurrentTime()) { axios.get('/wind', { params: { time: data.time}).then(function (result) { velocityLayer.setData(result.data) }); } });

Thank a lot for your answer. I solved my issue.

Pobx avatar Apr 29 '21 13:04 Pobx

For now what I'm doing is listening for the event timeloading and update the velocity. Something like this:

map.timeDimension.on('timeloading', function (data) { if (data.time == map.timeDimension.getCurrentTime()) { axios.get('/wind', { params: { time: data.time}).then(function (result) { velocityLayer.setData(result.data) }); } });

Could you pls explain in more detail? Do you have any demo to show? Currently I have a list of json files convert from grib files, and I want to put them into a Playback timeline.

lttrung24 avatar Aug 09 '21 16:08 lttrung24

Hi @lttrung24 ,

I'm sorry but I'm not using timeDimension anymore.

Even though the code that I posted here worked I ended up creating a simple time slider myself.

Best regards, Eduardo

k3bra avatar Aug 09 '21 18:08 k3bra

Hi @k3bra, Great to hear from you. Would you mind sharing some document or suggestion about creating your time slider? Many thanks in advance!

lttrung24 avatar Aug 10 '21 02:08 lttrung24