satellogic / telluric

telluric is a Python library to manage vector and raster geospatial data in an interactive and easy way
MIT License
87 stars 18 forks source link

Reduce default zoom for points #55

Open astrojuanlu opened 6 years ago

astrojuanlu commented 6 years ago

When one displays a point in telluric, the zoom level is maximum and the tiles are not shown. We should choose a sensible zoom value.

astrojuanlu commented 6 years ago

As simple as:

diff --git telluric/plotting.py telluric/plotting.py
index f48cc10..c90f35b 100644
--- telluric/plotting.py
+++ telluric/plotting.py
@@ -135,7 +135,7 @@ def plot(feature, mp=None, style_function=None, **map_kwargs):
     else:
         if mp is None:
             center = feature.envelope.centroid.reproject(WGS84_CRS)
-            zoom = zoom_level_from_geometry(feature.envelope)
+            zoom = min(zoom_level_from_geometry(feature.envelope), 15)

             mp = Map(center=(center.y, center.x), zoom=zoom, **map_kwargs)
astrojuanlu commented 6 years ago

...15 is an arbitrary value that, for the case of our default basemap (stamen terrain), does not always contain data in all regions.