ENH: provide mapbox viewport coordinates in relayout data
See original GitHub issueI would like the mapbox subplot relayout data to include the lon
/lat
of the viewport corners. This would make it possible to use a mapbox subplot to display an image layer that is dynamically generated for the current viewport.
The relayout data currently includes mapbox.center
, mapbox.zoom
, mapbox.bearing
, and mapbox.pitch
. I would like to propose that we include a mapbox.coordinates
property that contains an array of the lon/lat coordinates of the four corners of the viewport.
This would match the coordinates
property that is expected in image
layers. See https://docs.mapbox.com/mapbox-gl-js/example/image-on-a-map/.
These points can be generated from the mapbox API by following the example in https://github.com/mapbox/mapbox-gl-js/issues/2375#issuecomment-204297638.
Question:
Could coordinates
be something that is added only to relayout
data, or would it need to be a new figure property as well? The reason it’s not clear to me that it should be a property is that it would be read-only. I don’t think we could really support setting coordinates
as a way to set where to place the viewport (at least in the case of non-zero bearing
and pitch
).
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
For now though
plotly_relayout
event data maps exactly toPlotly.relayout
arguments, so in principle folks may be using this to accumulate changes that get fed back to the same or another plot later. If we add in other things that look like attributes, this would lead to invalid figures - mostly silently so, but confusing and potentially painful in case there’s any chance we’d add attributes with these names later.But perhaps we could add something that is clearly NOT an attribute? Like:
_derived: {coordinates: ...}
Works for me! I’ll open a PR shortly…