environmentaltools.graphics.image_spoof
- environmentaltools.graphics.image_spoof(self, tile)[source]
Reformat web requests from OSM for cartopy compatibility.
Spoofs the user agent in HTTP requests to OpenStreetMap tile servers, allowing cartopy to download and display map tiles.
Heavily based on code by Joshua Hrisko: https://makersportal.com/blog/2020/4/24/geographic-visualizations-in-python-with-cartopy
- Parameters:
self – The tile image object (OSM or QuadtreeTiles instance).
tile – Tile coordinates tuple.
- Returns:
(image, extent, origin) compatible with cartopy.
- Return type:
tuple