shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
722 stars 288 forks source link

Cache the Imagery Metadata (Bing Maps) #263

Closed mcartoixa closed 7 years ago

mcartoixa commented 7 years ago

This is a request for a (maybe) special case: we use the Bing Maps provider to create thumbnails for our data in a search engine. The tiles seem to be fetched cleverly, and they are cached in the browser.

My problem is that if I create 20 thumbnails, the Bing provider will fetch the Imagery Metadata 20 times (with the same results, obviously). So the number of billable transactions skyrocket needlessly (by a factor of about ~20 in my case) and so do my costs.

Do you think it would be possible for multiple Bing layers to share the same metadata?

brunob commented 7 years ago

Do you think it would be possible for multiple Bing layers to share the same metadata?

I've nether think about this so i have no clue, but feel free to provide a PR if you have a patch for it :)

mcartoixa commented 7 years ago

Well, the clock was ticking so I ended up integrating my own version of the plugin in our project. After battling with the asynchronous nature of JSONP requests (I don't know how you manage to make it work, btw), my plugin is now about twice the size of the original so I don't know if you could call that a patch ;-)

I may open source it at some point.

The principle is quite simple:

brunob commented 7 years ago

Ok, thx for the feedback, i think we can close this issue now you found a way to manage it by your side.