The following types can be imported from react-map-gl
when using TypeScript.
A custom control implementation.
A custom layer implementation.
Instance ref of a Map
component. See Map documentation for details.
An object conforming to the Mapbox Style Specification.
An object conforming to the Fog Style Specification.
An object conforming to the Light Style Specification.
An object conforming to the Terrain Style Specification.
An object conforming to the Projection Style Specification.
A JSON object that defines a background
layer according to the Mapbox Style Specification.
A JSON object that defines a circle
layer according to the Mapbox Style Specification.
A JSON object that defines a fill-extrusion
layer according to the Mapbox Style Specification.
A JSON object that defines a fill
layer according to the Mapbox Style Specification.
A JSON object that defines a heatmap
layer according to the Mapbox Style Specification.
A JSON object that defines a hillshade
layer according to the Mapbox Style Specification.
A JSON object that defines a line
layer according to the Mapbox Style Specification.
A JSON object that defines a raster
layer according to the Mapbox Style Specification.
A JSON object that defines a symbol
layer according to the Mapbox Style Specification.
A JSON object that defines a sky
layer according to the Mapbox Style Specification.
A JSON object that defines a geojson
source according to the Mapbox Style Specification.
A JSON object that defines a video
source according to the Mapbox Style Specification.
A JSON object that defines a image
source according to the Mapbox Style Specification.
A JSON object that defines a vector
source according to the Mapbox Style Specification.
A JSON object that defines a raster
source according to the Mapbox Style Specification.
A JSON object that defines a raster-dem
source according to the Mapbox Style Specification.
A JSON object that defines a canvas
source type. See CanvasSourceOptions.
One of 'top-right'
, 'top-left'
, 'bottom-right'
and 'bottom-left'
.
An object with the following fields:
left
: number - in pixels.top
: number - in pixels.right
: number - in pixels.bottom
: number - in pixels.
A mapboxgl.LngLat object.
A LngLat object, an array of two numbers representing longitude and latitude, or an object with lng
and lat
or lon
and lat
properties.
A mapboxgl.LngLatBounds object.
A LngLatBounds object, an array of LngLatLike objects in [sw, ne] order, or an array of numbers in [west, south, east, north] order.
A mapboxgl.Point object.
A Point or an array of two numbers representing x and y screen coordinates in pixels.
A GeoJSON feature that also contains the following library-specific fields:
layer
: Layersource
: stringsourceLayer
: stringstate
: { [key: string]: any }
An object with the following fields:
longitude
: number - The longitude of the map center.latitude
: number - The latitude of the map center.zoom
: number - The zoom level.pitch
: number - The pitch (tilt) of the map, in degrees.bearing
: number - The bearing (rotation) of the map, in degrees.
The following are implementations of source types that could be retrieved with Map.getSource
(Mapbox | Maplibre).
A source containing GeoJSON. See GeoJSONSource
(Mapbox | Maplibre).
A source containing video. See VideoSource
(Mapbox | Maplibre).
A source containing image. See ImageSource
(Mapbox | Maplibre).
A source containing the contents of an HTML canvas. See CanvasSource
(Mapbox | Maplibre).
A source containing vector tiles in Mapbox Vector Tile format. See VectorTileSource
(Mapbox | Maplibre).
An object with the following fields:
An object with the following fields:
type
: stringtarget
:Map
(Mapbox | Maplibre)originalEvent?
: MouseEventpoint
: PointlngLat
: LngLatpreventDefault
: () => voiddefaultPrevented
: booleanfeatures?
: MapGeoJSONFeature[]
An object with the following fields:
type
: stringtarget
:Map
(Mapbox | Maplibre)originalEvent?
: WheelEventpreventDefault
: () => voiddefaultPrevented
: boolean
An object with the following fields:
type
: stringtarget
:Map
(Mapbox | Maplibre)originalEvent?
: TouchEventpoint
: PointlngLat
: LngLatpoints
: Point[]lngLats
: LngLat[]preventDefault
: () => voiddefaultPrevented
: booleanfeatures?
: MapGeoJSONFeature[]
An object with the following fields:
type
: string - Event typetarget
:Map
(Mapbox | Maplibre)viewState
: ViewState - the next view state that the camera wants to change to based on user input or transition.
An object with the following fields:
type
: stringtarget
:Map
(Mapbox | Maplibre)originalEvent?
: MouseEventboxZoomBounds
: LngLatBounds
An object with the following fields:
An object with the following fields:
type
: stringtarget
:Map
(Mapbox | Maplibre)dataType
: 'source'isSourceLoaded
: booleansource
: stringsourceId
: stringsourceDataType
: 'metadata' | 'content'tile
: anycoord
: Coordinate
See MapDataEvent.
An object with the following fields:
An object with the following fields:
An object with the following fields:
type
: stringtarget
:GeolocateControl
(Mapbox | Maplibre)coords
: GeolocationCoordinates - the current location.timestamp
: number - the time at which the location was retrieved.
An object with the following fields:
type
: stringtarget
:GeolocateControl
(Mapbox | Maplibre)code
: PERMISSION_DENIED | POSITION_UNAVAILABLE | TIMEOUT - see GeolocationPositionErrormessage
: string - the details of the error. Specifications note that this is primarily intended for debugging use and not to be shown directly in a user interface.
An object with the following fields:
An object with the following fields:
An object with the following fields: