MapView
July 26, 2021 ยท View on GitHub
The MapView class is a subclass of View. This viewport creates a camera that looks at a geospatial location on a map from a certain direction. The behavior of MapView is generally modeled after that of Mapbox GL JS.
It's recommended that you read the Views and Projections guide before using this class.
Constructor
import {MapView} from '@deck.gl/core';
const view = new MapView({id, ...});
MapView takes the same parameters as the View superclass constructor, plus the following:
repeat (Boolean, optional)
Whether to render multiple copies of the map at low zoom levels. Default false.
nearZMultiplier (Number, optional)
Scaler for the near plane, 1 unit equals to the height of the viewport. Default to 0.1. Overwrites the near parameter.
farZMultiplier (Number, optional)
Scaler for the far plane, 1 unit equals to the distance from the camera to the top edge of the screen. Default to 1.01. Overwrites the far parameter.
View State
To render, MapView needs to be used together with a viewState with the following parameters:
longitude(Number) - longitude at the map centerlatitude(Number) - latitude at the map centerzoom(Number) - zoom levelpitch(Number, optional) - pitch angle in degrees. Default0(top-down).bearing(Number, optional) - bearing angle in degrees. Default0(north).maxZoom(Number, optional) - max zoom level. Default20.minZoom(Number, optional) - min zoom level. Default0.maxPitch(Number, optional) - max pitch angle. Default60.minPitch(Number, optional) - min pitch angle. Default0.
Controller
By default, MapView uses the MapController to handle interactivity. To enable the controller, use:
const view = new MapView({id: 'base-map', controller: true});
Visit the MapController documentation for a full list of supported options.