buche / leaflet-openweathermap

A JavaScript library for including OpenWeatherMap's layers and OWM's current city/station data in leaflet based maps without hassle.
259 stars 132 forks source link

Issue with excessive calls to OWM API? #26

Open Xeverus01 opened 6 years ago

Xeverus01 commented 6 years ago

Have you had any issue using this and dramatically overstepping the 60 calls per minute rule? I just got flagged for 745/60 calls per minute when there was only two users and the functions are run once.

It looks like the script is querying the API 12 times per layer toggle.

GET https://c.tile.openweathermap.org/map/precipitation/2/1/1.png?appid=KEY 429 ()...

buche commented 6 years ago

Every access to a tile needs the appid or there will be no tile. So if you switch layers there a a lot of tiles to load. That's not something I can circumvent, it is demanded by OWM.

Just a note: I'm not affiliated with OpenWeatherMap in any way. I just wrote this Leaflet addon in my spare time for my own curiosity and to let others build Leaflet based maps with access to OWM. At that time OWM was free, there was no price list at all.

My example page is just a demonstration of the js lib and it is not for permanent or productive usage. If you want to use OWM reliable, then you have to buy your own API Key running your own website using my free lib. Look at https://www.openweathermap.org/price

I'm using a free API Key with limited calls for the example page. I think some people are using my example page and maybe some people have copied my AppId for their own websites, too. Every day I get at least one reminder from OWM that my API Key is blocked for some time due to excessive usage. OWM tells me that sometimes there are more than 4000 requests per minute. An API Key for this amount of requests ("Professional)" would cost me 470 USD per month!

Xeverus01 commented 6 years ago

Hey Buche, thanks for the reply. I've used my own key and I'm just really confused how a few people could create 745 calls in under a minute. I love the applet you've made as its works really well - just trying to figure out what would create X number of calls.