socib / Leaflet.TimeDimension

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

TimeDimension AND Velocity #144

Open xelaboy opened 6 years ago

xelaboy commented 6 years ago

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.

r1m commented 6 years ago

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

k3bra commented 5 years ago

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

k3bra commented 5 years ago

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) }); } });

Pobx commented 3 years ago

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.

lttrung24 commented 3 years ago

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.

k3bra commented 3 years ago

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

lttrung24 commented 3 years ago

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