developmentseed / developmentseed/lonboard

feature: add support to zoom into a specific layer

Open
#544 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
964
Forks
54
Avg merge
5m
Merged PRs (30d)
1

Description

When plotting a Map with multiple layers, I'd like to have an option to zoom in into a specific layer. For example, in this blog https://ibis-project.org/posts/ibis-duckdb-geospatial/ I have some code that plots a point, two lines (over some roads), and the NYC streets, that looks like this

```
broad_station_layer = ScatterplotLayer.from_geopandas(
broad_station_gdf, get_fill_color="blue", get_radius=5
)
sts_near_broad_layer = PathLayer.from_geopandas(
sts_near_broad_gdf, get_color="red", opacity=0.4, get_width=2
)
streets_layer = PathLayer.from_geopandas(streets_gdf, get_color="grey", opacity=0.3)
m = Map(
[
broad_station_layer,
sts_near_broad_layer,
streets_layer,
],
view_state={"longitude": -74.01066, "latitude": 40.7069, "zoom": 16} # need this to zoom into desired outcome
)
m
```
![Screenshot 2024-06-13 at 2 01 47 PM](https://github.com/developmentseed/lonboard/assets/7526622/8fdd854c-f19a-45b2-b932-38de4c033a82)

However, without specifying the `view_state` the map displays like this, and the first two layers get completely lost unless I manually zoom in. It would be great if I could zoom in a box around let's say the first two layers or one of them, without having to find what is the lat, lon and specific zoom value.

![Screenshot 2024-06-13 at 2 01 28 PM](https://github.com/developmentseed/lonboard/assets/7526622/c662cc9c-b2b4-4023-887e-a03f41340ffa)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.