Giter Site home page Giter Site logo

updateTimeDimension about leaflet.timedimension HOT 5 CLOSED

socib avatar socib commented on May 22, 2024
updateTimeDimension

from leaflet.timedimension.

Comments (5)

bielfrontera avatar bielfrontera commented on May 22, 2024

Hi!
I've checked the GetCapabilities response of the WMS you are using. Layer '1' doesn't have a Extent[name="time"] element. But its parent yes (it seems to be a nested layers structure).
I've changed the code, and now it gets the available times from the layer or its parent.

Take into account that you would need to setup a proxy to make the request (example https://github.com/socib/Leaflet.TimeDimension/blob/master/examples/server/proxy.php).

I will add a page in this repository to collect Leaflet.TimeDimension examples of usage. Feel free to add your case.

from leaflet.timedimension.

eflowbeach avatar eflowbeach commented on May 22, 2024

Hi again,

So, I added your changes from commit 9ad9ab7 and I added a proxy call with the proxy.php script you politely provided:

eflowbeach/MobileWeather@36c9355

and I still get time=undefined here:

_newTimeIndexLoaded: function() {
if (this._loadingTimeIndex == -1) {
return;
}
var time = this._availableTimes[this._loadingTimeIndex]; // <----still available times is empty

Thank you for your help!

from leaflet.timedimension.

bielfrontera avatar bielfrontera commented on May 22, 2024

Hi,
I have uploaded a new example with this layer (see http://apps.socib.es/Leaflet.TimeDimension/examples/example14.html ).

There is a conflict between times setted in your timeDimensionOptions and the times retrieved from getCapabilities. With this configuration, the program does an intersection of both. And this intersection is null.

If you active updateTimeDimension option, after retrieving available times from the server, the timedimension component is update according to the updateTimeDimensionMode parameter. By default this mode is 'intersect', and you might want to change it to 'replace' (see https://github.com/socib/Leaflet.TimeDimension#-options-2 ).

I would recommend to not set timeInterval and period options, as you will see in the example 14. Therefore, the available times will be the ones retrieved from the server.

from leaflet.timedimension.

eflowbeach avatar eflowbeach commented on May 22, 2024

Thanks Biel! It is working now. 👍

So, since I removed the timeInterval and period options, is there a way to limit the amount of frames to say 1 hour worth of data (maybe the cache options do this?) ? If not, I could probably provide you with a pull request that does this.

Btw, this is a really cool library!

from leaflet.timedimension.

bielfrontera avatar bielfrontera commented on May 22, 2024

Thanks! :)

It might be useful to add maxTime and minTime optional parameters to the layer, and modify the list of times retrieved from the server (probably at setAvailableTimes).

But you can filter the list with the default list of times. But this default list must match the times on the server.

NOAA's layer is composed by layers each 5 minutes. You need to make sure that you create the default list of times taking a date with minutes finishing in 0 or 5 (and 0 seconds).

var endDate = new Date();
endDate.setUTCSeconds(0, 0);
var minutes = endDate.getUTCMinutes();
endDate.setUTCMinutes(minutes - (minutes % 5));
[...]
    timeDimensionOptions: {
        timeInterval: "PT1H/" + endDate.toISOString(),
        period: "PT5M", // or  "PT10M"...
    },

updateTimeDimensions option is still recommended to remove the last occurrence, if it is still not available on the server.

from leaflet.timedimension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.