Skip to content

Layer disappears if zoomed out. Reappears when zooming. #2811

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

Open
kurt-rhee opened this issue Oct 7, 2020 · 0 comments
Open

Layer disappears if zoomed out. Reappears when zooming. #2811

kurt-rhee opened this issue Oct 7, 2020 · 0 comments
Labels
bug something broken P3 backlog

Comments

@kurt-rhee
Copy link

Issue:
Objects will disappear if the zoom level of the graph is increased to a certain amount.

Demo:

  • image

  • Image 1: Zoomed out version of a graph

  • image

  • Image 2: Zoomed in version of the same graph

Specifications:
Plotly Version: 4.10.0

Code:

I included pickled versions of the buildable land / trackers objects here. They are geodataframes.

    # --- Set up base map ---
    fig = go.Figure(go.Scattermapbox())
    fig.update_layout(
        mapbox_accesstoken = token,
        mapbox_style = "mapbox://styles/skrhee/ckbtiaefh0wrr1hp7h4ya3zy4",
        mapbox_zoom = 13,
        mapbox_center = {'lon': centroid_lon, 'lat': centroid_lat},
        margin = {'l':0, 'r':0, 'b':0, 't':0},
        height = 500
        )
     
    layers = []
    # --- Add buildable polygons ---
    full_buildable = MultiPolygon(list(buildable_land['geometry']))
    obj = gd.GeoSeries(full_buildable).to_json()
    poly_json = json.loads(obj)
    
    layer = {
        'source': poly_json,
        'type': "fill",
        'below': "traces",
        'color': "royalblue",
        'opacity': 0.65
        }
    layers.append(layer)
    
    # --- Add tracker polygons ---
    trackers = gd.read_file(df['AL_0.0'][0])
    full_trackers = MultiPolygon(list(trackers['geometry']))
    obj = gd.GeoSeries(full_trackers).to_json()
    poly_json = json.loads(obj)
    
    layer = {
        'source': poly_json,
        'type': "fill",
        'below': "traces",
        'color': "royalblue",
        'opacity': 0.65
        }
    layers.append(layer)


    
    # --- Update Figure ---
    fig.update_layout(
        mapbox = {
            'layers': layers
            }
        )

    st.plotly_chart(fig, use_container_width=True)


[pickles.zip](https://github.com/plotly/plotly.py/files/5343508/pickles.zip)






@gvwilson gvwilson self-assigned this Jun 18, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog bug something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants