Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] None default get_line_color in PolygonLayer not respected #541

Closed
ncclementi opened this issue Jun 10, 2024 · 4 comments
Closed

[BUG] None default get_line_color in PolygonLayer not respected #541

ncclementi opened this issue Jun 10, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@ncclementi
Copy link

Context

I'm plotting a PolygonLayer in a map, I have something like:

pol = PolygonLayer.from_geopandas(
    my_polygon, get_fill_color="orange", opacity=0.1
)
mh = Map(
    [pol ], 
)

and when displayed on the map. I see a line and I which not to.

Screenshot 2024-06-10 at 7 22 01 PM

Environment

  • OS: MacOS Sonoma 14.5
  • Lonboard Version: 0.9.1

Steps to reproduce the bug

This is part of a long workflow, trying to transform this blog to use just plain lonboard and avoid leafmap https://ibis-project.org/posts/ibis-duckdb-geospatial/ the code is the last cell, and I converted into:

broad_station_layer = ScatterplotLayer.from_geopandas(
    broad_station_gdf, get_fill_color="orange", get_radius=5
)

broad_station_zone_layer = PolygonLayer.from_geopandas(
    broad_station_zone, get_fill_color="orange", opacity=0.1
)

h_near_broad_layer = ScatterplotLayer.from_geopandas(
    h_near_broad_gdf, get_fill_color="red", get_radius=5
)

h_street_layer = PathLayer.from_geopandas(
    h_street_gdf, get_color="blue", opacity=0.5, get_width=2
)

streets_layer = PathLayer.from_geopandas(streets_gdf, get_color="grey", opacity=0.3)

mh = Map(
    [
        broad_station_layer,
        broad_station_zone_layer,
        h_near_broad_layer,
        h_street_layer,
        streets_layer,
    ], 
    view_state={"longitude": -74.01066, "latitude": 40.7069, "zoom": 16}
)
mh
@ncclementi ncclementi added the bug Something isn't working label Jun 10, 2024
@kylebarron
Copy link
Member

👋 I'm back from vacation.

The default for get_line_color is [0, 0, 0, 255], which represents black. To avoid drawing a line, set stroked: False

@ncclementi
Copy link
Author

Oh nice, I missed that on the docs. Ended up leaving it as it was, so we could merged a PR, but now this blog https://ibis-project.org/posts/ibis-duckdb-geospatial/ is using lonboard all the way.

I know this is out of scope, but there is no way to get automatic zoom on a layer right? I had to use view_state and provide specific lat and lon to get the nice zoom on the plot.

@kylebarron
Copy link
Member

There's currently automatic zoom on the map but not on each layer. Can you create a new issue for this? We store a bbox and weighted centroid on each layer, so we could potentially implement a "zoom to layer extent" method pretty easily.

@ncclementi
Copy link
Author

xref: #544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants