Skip to content

ENH: provide mapbox viewport coordinates in relayout data #4399

Closed
@jonmmease

Description

@jonmmease

I 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
mapbox/mapbox-gl-js#2375 (comment).

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions