How Do I Zoom to a Specific Value?
To zoom to a specific value, you can set the zoom level with setViewState
:
const state = instance.viewState; const newState = state.set("zoom", yourPreferredZoomValue); instance.setViewState(newState);
If a number value is used, it must be between instance.minimumZoomLevel
and instance.maximumZoomLevel
.