socib / Leaflet.TimeDimension

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

Auto update available times from WMS capabilities #175

Closed bambryan closed 4 years ago

bambryan commented 4 years ago

I am looking to pull new times available from the WMS layer to check for a new frame of available radar image. Radar updates every 2 minutes so I was going to fire every 60 seconds a check but keep hitting a brick wall on what action and method needs to be used. Or have just a

    function newTime() {
            var endDate = new Date();

            map.timeDimension.setCurrentTime(endDate.toISOString())
            map.timeDimension.setAvailableTimes("PT30M/" + endDate + "/PT2M",'replace')     
            console.log(map.timeDimension.getAvailableTimes());

            setTimeout(newTime, 60 * 1000)
    };  

Then this is where I am stuck....Not sure how to feed it the new current time and remove the oldest then move slider to newest.

I couldn't pull from the get capabilities because for some reason it's doing PT1S and not PT2M now so if I can just make it up as it should be there every 2 minutes that should work.

Odd that I can't find anything specific to this particular questions.

bambryan commented 4 years ago

Found the solution https://github.com/socib/Leaflet.TimeDimension/issues/101