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

Add opacity effect to mapbox layers sourcetype "image" #4490

Closed
meteoDaniel opened this issue Jan 16, 2020 · 2 comments · Fixed by #4525
Closed

Add opacity effect to mapbox layers sourcetype "image" #4490

meteoDaniel opened this issue Jan 16, 2020 · 2 comments · Fixed by #4525
Assignees
Labels
bug something broken

Comments

@meteoDaniel
Copy link

Dear all would be great to have this feature.

I asked why it is not working in the plotly.py project: plotly/plotly.py#2077

import plotly.graph_objects as go

fig = go.Figure(go.Scattermapbox(), layout=dict(width=600, height=450))
mapbox = dict(zoom= 4.5,
              style='open-street-map',
              center=dict(
                        lat=42,
                        lon=-74.5),
              layers=[
                  dict(
                  below ='',
                      opacity=0.6,
                  source = "https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif",
                  sourcetype= "image",
                  coordinates =  [
                          [-80.425, 46.437], [-71.516, 46.437], [-71.516, 37.936], [-80.425, 37.93]
                                 ])
                     ])
fig.update_layout(mapbox=mapbox)
fig.show()
@meteoDaniel meteoDaniel changed the title Add opacity effect too mapbox layers sourcetype "image" Add opacity effect to mapbox layers sourcetype "image" Jan 16, 2020
@etpinard
Copy link
Contributor

Thanks for reporting. I'll call this a bug as opacity is part of the mapbox layout layer attributes.

Fixing this bug should be as easy as adding 'raster-opacity': opts.opacity to

Lib.extendFlat(paint, {
'raster-fade-duration': 0
});

similar to https://docs.mapbox.com/mapbox-gl-js/example/adjust-layer-opacity/

@etpinard etpinard added the bug something broken label Jan 27, 2020
@etpinard etpinard self-assigned this Jan 28, 2020
@meteoDaniel
Copy link
Author

meteoDaniel commented Feb 6, 2020

Thanks for this fast support guys !
@etpinard is this working with python right now? Or do i have to update the version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants