Feature request
-
The app I am working on has multiple markers on the page and I would love to be able to get the layer data after moving the time slider for those markers based on the LatLon of the markers. I have tried on redrawFinished to move the picker around to the spots to get the layer data but it is just not gonna work.
A great to have (for me) would be an overlay.getData(lat, lon) method that would return the info that I could run anytime but especially on redrawFinished...
Thanks for the great (make that GREAT) product you all are creating!!
-
An even better method would be one where I could get back data based on the overlay I pass in:
Something like: overlay.getData(lat, lon, 'wind') or overlay.getData(lat, lon, 'temp') then it would not matter what overlay I was on...
-
Good news:
The interpolator function has been added in the latest API. Documented here:
https://github.com/windycom/windy-plugins/tree/master/examples/09-reading-weather-valuesThx Windy team!!
-
@rittels So, those are in Windy plugins, not the page API, right?
I have never written a plugin. Do I need visual studio or ??
-
Interpolator function has now been added to the API. However, it is not in the windyAPI object but in W.
short example:
const {interpolator} = W; broadcast.on("redrawFinished", e=>{ interpolator(interfun=>{ let mc=map.getCenter(); //pass your coords to the interpolator function console.log("Weather at map center: ", interfun({lat: mc.lat,lon: mc.lng})); }) })
-
That worked and got me way ahead of where I thought I'd be. Thanks so much!!
Question though, I am having trouble with other Leaflet methods and the console is telling me the requested method does not exist but I am clearly following the code per the Leaflet docs. Is there something limiting my access to certain things because I am not using the paid API? As I get further along, I will be getting the paid version.
The specific code I am struggling with is:
let mnw = map.getNorthWest();
In fact, most of the map locations not map.getCenter() are not working.
Thanks again.
-
let mnw = map.getBounds().getNorthWest();
-
Ahhh. I am using leaflet 0.7.7, should I be using 1.4??
-
Windy API is Leaflet 0.7.7 at the moment.
Near future it will be updated to 1.4
Windy.com main site was updated to 1.4 few weeks ago.
-
@powellbound
Sorry about the confusion. API still 0.7.7, plugins 14.
Wanted to show getNorthWest() is method of LatLngBounds, not map. -
No worries, you have been a huge help. I was just unsure about the Leaflet version to use. I am looking forward to api 19!
Thanks again!!