geopandas / contextily

Context geo-tiles in Python
https://contextily.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
493 stars 81 forks source link

Fix bug in auto computation of zoom levels #214

Closed jelson closed 1 year ago

jelson commented 1 year ago

For maps with large aspect ratio, contextily downloads tiles as if the map was as small as the smallest dimension. It should base the zoom level on the dimension that's a larger extent.

I discovered this bug when my server died attempting to render the following blue line on a map: https://sondemaps.lectrobox.com/seattle/2023/4/13-17-47.64048--123.95468.jpg

This script has run fine for months, but in today's dataset the blue line coincidentally was almost perfectly horizontal. Therefore, the latitude extent of the map was very small, and because contextily uses the max of the two zoom levels, it attempted to download over a million zoomlevel 19 tiles from OSM.

martinfleis commented 1 year ago

Yay. Thanks for the fix!

Can you also update the test that are failing because of the change?

jelson commented 1 year ago

Oops - sorry about that; fixed.