8

It seems fetching Google tiles directly isn't supported very well by Google via normal API access (even with an API key). Hence, cartopy.io.img_tiles.GoogleTiles doesn't work well as it is able to fetch tiles only for one or two trials after which the requests start getting denied by Google.

What's the recommended way of using Google Maps with Cartopy?

Thanks

virtualmic
  • 2,774
  • 6
  • 23
  • 33
  • Including a valid API key is not sufficient. Billing must be enabled on your account to use gg maps services. (Quote from gg: `As of June 11, 2018, you must enable billing with a credit card and have a valid API key for all of your projects. This will give you the ability to scale easily with less downtime and fewer performance issues. In addition, we’ve simplified our 18 individual APIs into three products: Maps, Routes, and Places.`) – swatchai Dec 26 '18 at 05:10
  • @swatchai Billing is enabled. I think retrieving tiles is an issue here, which isn't supported generally by Google Maps. – virtualmic Dec 26 '18 at 07:49
  • If you can get tiles for one or two trials, maybe you can cache the tiles for later use? Therefore you only need to get the tiles once. – gepcel Dec 27 '18 at 05:58

1 Answers1

1

Instead of using Google map tiles, I am using Mapbox static tiles API and it seems to be working well. They are currently offering 50,000 calls to the API for free (even for commercial use).

I have monkey patched GoogleWTS.get_image function as described here to update the URL and storing tiles in a local cache (which I delete every week to get fresh data): https://github.com/SciTools/cartopy/issues/1341#issuecomment-511116060.

virtualmic
  • 2,774
  • 6
  • 23
  • 33