Here I am trying to achieve centering a MapBox
map in a given area:
- The area can be defined ideally by a (sub) set of annotations
- Alternatively it can just be an a rectangle for simplicity
From what I know from its documentation, MapBox
only allows centering in a single centerCoordinate
and setting zoomLevel
. By setting zoomLevel
there seems to be no guarantee that the rectangle will be contained inside the MapBox
.
How to achieve a whole area being displayed at once and the map being centered around it?
<Mapbox
accessToken={'ACCESS_TOKEN'}
centerCoordinate={this.state.currentView.coordinates}
zoomLevel={this.state.currentView.zoomLevel}
/>