Types
The following types can be imported from react-map-gl/maplibre when using TypeScript.
Components
IControl
A custom control implementation.
CustomLayerInterface
A custom layer implementation.
MapRef
Instance ref of a Map component. See Map documentation for details.
Styling
StyleSpecification
An object conforming to the Maplibre Style Specification.
SkySpecification
An object conforming to the Sky Style Specification.
LightSpecification
An object conforming to the Light Style Specification.
TerrainSpecification
An object conforming to the Terrain Style Specification.
ProjectionSpecification
An object conforming to the Projection Style Specification.
BackgroundLayerSpecification
A JSON object that defines a background layer according to the Maplibre Style Specification.
CircleLayerSpecification
A JSON object that defines a circle layer according to the Maplibre Style Specification.
FillExtrusionLayerSpecification
A JSON object that defines a fill-extrusion layer according to the Maplibre Style Specification.
FillLayerSpecification
A JSON object that defines a fill layer according to the Maplibre Style Specification.
HeatmapLayerSpecification
A JSON object that defines a heatmap layer according to the Maplibre Style Specification.
HillshadeLayerSpecification
A JSON object that defines a hillshade layer according to the Maplibre Style Specification.
LineLayerSpecification
A JSON object that defines a line layer according to the Maplibre Style Specification.
RasterLayerSpecification
A JSON object that defines a raster layer according to the Maplibre Style Specification.
SymbolLayerSpecification
A JSON object that defines a symbol layer according to the Maplibre Style Specification.
GeoJSONSourceSpecification
A JSON object that defines a geojson source according to the Maplibre Style Specification.
VideoSourceSpecification
A JSON object that defines a video source according to the Maplibre Style Specification.
ImageSourceSpecification
A JSON object that defines a image source according to the Maplibre Style Specification.
VectorSourceSpecification
A JSON object that defines a vector source according to the Maplibre Style Specification.
RasterSourceSpecification
A JSON object that defines a raster source according to the Maplibre Style Specification.
RasterDEMSourceSpecification
A JSON object that defines a raster-dem source according to the Maplibre Style Specification.
CanvasSourceSpecification
A JSON object that defines a canvas source type. See CanvasSourceSpecification.
Configurations
ControlPosition
One of 'top-right', 'top-left', 'bottom-right' and 'bottom-left'.
PaddingOptions
An object with the following fields:
left: number - in pixels.top: number - in pixels.right: number - in pixels.bottom: number - in pixels.
Data Types
LngLat
A Maplibre LngLat object.
LngLatLike
A Maplibre LngLatLike object.
LngLatBounds
A Maplibre LngLatBounds object.
LngLatBoundsLike
A Maplibre LngLatBoundsLike object.
Point
A Maplibre Point object.
PointLike
A Maplibre PointLike object.
MapGeoJSONFeature
A GeoJSON feature that also contains the following library-specific fields:
layer: Layersource: stringsourceLayer: stringstate:{ [key: string]: any }
ViewState
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.
Events
MapEvent
An object with the following fields:
MapLayerMouseEvent
An object with the following fields:
type: stringtarget: MaporiginalEvent?: MouseEventpoint: PointlngLat: LngLatpreventDefault: () => voiddefaultPrevented: booleanfeatures?: MapGeoJSONFeature[]
MapWheelEvent
An object with the following fields:
type: stringtarget: MaporiginalEvent?: WheelEventpreventDefault: () => voiddefaultPrevented: boolean
MapLayerTouchEvent
An object with the following fields:
type: stringtarget: MaporiginalEvent?: TouchEventpoint: PointlngLat: LngLatpoints: Point[]lngLats: LngLat[]preventDefault: () => voiddefaultPrevented: booleanfeatures?: MapGeoJSONFeature[]
ViewStateChangeEvent
An object with the following fields:
type: string - Event typetarget: MapviewState: ViewState - the next view state that the camera wants to change to based on user input or transition.
MapBoxZoomEvent
An object with the following fields:
type: stringtarget: MaporiginalEvent?: MouseEventboxZoomBounds: LngLatBounds
MapStyleDataEvent
An object with the following fields:
type: stringtarget: MapdataType: 'style'
MapSourceDataEvent
An object with the following fields:
type: stringtarget: MapdataType: 'source'isSourceLoaded: booleansource: stringsourceId: stringsourceDataType: 'metadata' | 'content'tile: anycoord: Coordinate
See MapDataEvent.
ErrorEvent
An object with the following fields:
GeolocateEvent
An object with the following fields:
type: stringtarget: GeolocateControl
GeolocateResultEvent
An object with the following fields:
type: stringtarget: GeolocateControlcoords: GeolocationCoordinates - the current location.timestamp: number - the time at which the location was retrieved.
GeolocateErrorEvent
An object with the following fields:
type: stringtarget: GeolocateControlcode: 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.
MarkerEvent
An object with the following fields:
type: stringtarget: Marker
MarkerDragEvent
An object with the following fields:
PopupEvent
An object with the following fields:
type: stringtarget: Popup