Skip to content

Types

GeoJSONFeatureI

表示一个GeoJSON要素的接口

Type: GeoJSONFeatureI

Examples

javascript
GeoJSON.Feature<
 GeoJSON.Geometry & (GeoJSON.Point | GeoJSON.LineString | GeoJSON.Polygon),
 GeoJSON.GeoJsonProperties
>

FearureType

基础要素类型

Type: ("circle" | "polygon" | "polyline" | "polygonExtrusion" | "symbol" | "heatmap")

CapitalizeStr

将字符串的第一个字母转换为大写字母

Type: CapitalizeStr

Examples

javascript
type CapitalizeStr<Str extends string> =
   Str extends `${infer First}-${infer Rest}`
     ? `${First}${Capitalize<CapitalizeStr<Rest>>}`
     : Str

CapitalizeKey

将对象的键的第一个字母转换为大写字母

Type: CapitalizeKey

Examples

javascript
type CapitalizeKey<obj extends object> = {
 [Key in keyof obj as CapitalizeStr<Key & string>]: obj[Key]
}

PluginStatus

插件状态

Type: ("unavailable" | "loading" | "loaded" | "error")

LngLatLike

经度和纬度

Type: ([number, number] | LngLat | {lng: number, lat: number} | {lon: number, lat: number})

LngLatBoundsLike

经纬度范围

Type: (LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number])

PointLike

Type: (Point | [number, number])

Offset

偏移量

Type: (number | PointLike | {: PointLike})

ExpressionName

表达式名称

Type: ("array" | "boolean" | "collator" | "format" | "literal" | "number" | "number-format" | "object" | "string" | "image" | "to-boolean" | "to-color" | "to-number" | "to-string" | "typeof" | "feature-state" | "geometry-type" | "id" | "line-progress" | "properties" | "at" | "get" | "has" | "in" | "index-of" | "length" | "slice" | "!" | "!=" | "<" | "<=" | "==" | ">" | ">=" | "all" | "any" | "case" | "match" | "coalesce" | "within" | "interpolate" | "interpolate-hcl" | "interpolate-lab" | "step" | "let" | "var" | "concat" | "downcase" | "is-supported-script" | "resolved-locale" | "upcase" | "rgb" | "rgba" | "to-rgba" | "-" | "*" | "/" | "%" | "^" | "+" | "abs" | "acos" | "asin" | "atan" | "ceil" | "cos" | "e" | "floor" | "ln" | "ln2" | "log10" | "log2" | "max" | "min" | "pi" | "round" | "sin" | "sqrt" | "tan" | "zoom" | "heatmap-density")

Expression

表达式

Type: [ExpressionName, ...Array<any>]

Anchor

锚点

Type: ("center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right")

DragPanOptions

拖拽平移选项

Type: {linearity: number?, easing: function (t: number): number?, deceleration: number?, maxSpeed: number?}

Properties

InteractiveOptions

交互选项

Type: {around: "center"?}

Properties

  • around "center"?

MapboxOptions

Mapbox选项

Properties

quat

四元数

Type: Array<number>

vec3

三维向量

Type: Array<number>

FreeCameraOptions

自由相机选项

constructor

创建FreeCameraOptions的实例

Parameters

position

相机位置

Type: (MercatorCoordinate | undefined)

lookAtPoint

将相机视角转向某个点

Parameters

Returns void

setPitchBearing

设置相机的俯仰角和方位角

Parameters

Returns void

ResourceType

资源类型

Type: ("Unknown" | "Style" | "Source" | "Tile" | "Glyphs" | "SpriteImage" | "SpriteJSON" | "Image")

RequestParameters

请求参数

Properties

TransformRequestFunction

将请求参数转换为资源类型

Type: function (url: string, resourceType: ResourceType): RequestParameters

PaddingOptions

边距选项

Properties

FeatureIdentifier

要素标识符

Properties

BoxZoomHandler

框选缩放处理器

constructor

创建BoxZoomHandler的实例

Parameters

isEnabled

是否启用

Returns boolean

isActive

是否激活

Returns boolean

enable

启用框选缩放

Returns void

disable

禁用框选缩放

Returns void

ScrollZoomHandler

滚轮缩放处理器

constructor

创建ScrollZoomHandler的实例

Parameters

isEnabled

判断是否启用

Returns boolean

enable

启用滚轮缩放

Parameters

Returns void

disable

禁用滚轮缩放

Returns void

setZoomRate

设置缩放速率

Parameters

Returns void

setWheelZoomRate

设置滚轮缩放速率

Parameters

Returns void

DragPanHandler

拖拽平移处理器

constructor

创建DragPanHandler的实例

Parameters

isEnabled

判断是否启用

Returns boolean

isActive

判断是否激活

Returns boolean

enable

启用拖拽平移

Parameters

Returns void

disable

禁用拖拽平移

Returns void

DragRotateHandler

拖拽旋转处理器

constructor

创建DragRotateHandler的实例

Parameters

isEnabled

判断是否启用

Returns boolean

isActive

判断是否激活

Returns boolean

enable

启用拖拽旋转

Returns void

disable

禁用拖拽旋转

Returns void

KeyboardHandler

处理键盘事件的处理器

constructor

创建KeyboardHandler的实例

Parameters

isEnabled

判断是否启用

Returns boolean

enable

启用键盘事件处理

Returns void

disable

禁用键盘事件处理

Returns void

isActive

判断是否激活

Returns boolean

disableRotation

禁用旋转

Returns void

enableRotation

启用旋转

Returns void

DoubleClickZoomHandler

处理双击缩放的处理器

constructor

创建DoubleClickZoomHandler的实例

Parameters

isEnabled

判断是否启用

Returns boolean

enable

启用双击缩放

Returns void

disable

禁用双击缩放

Returns void

TouchZoomRotateHandler

处理触摸缩放和旋转的处理器

constructor

创建TouchZoomRotateHandler的实例

Parameters

isEnabled

判断是否启用

Returns boolean

enable

启用触摸缩放和旋转

Parameters

Returns void

disable

禁用触摸缩放和旋转

Returns void

disableRotation

禁用旋转

Returns void

enableRotation

启用旋转

Returns void

TouchPitchHandler

触摸倾斜处理器

constructor

创建TouchPitchHandler的实例

Parameters

enable

启用触摸倾斜

Parameters

Returns void

isActive

判断是否激活

Returns boolean

isEnabled

判断是否启用

Returns boolean

disable

禁用触摸倾斜

Returns void

IControl

控件接口

Properties

Control

控件
继承Evented
实现IControl

onAdd

添加控件

Parameters

Returns HTMLElement

onRemove

移除控件

Parameters

Returns void

getDefaultPosition

获取默认位置

Type: (function (): string | undefined)

PositionOptions

位置选项

enableHighAccuracy

是否启用高精度

Type: (boolean | undefined)?

timeout

超时时间

Type: (number | undefined)?

maximumAge

最大缓存时间

Type: (number | undefined)?

FullscreenControlOptions

全屏控制选项

Properties

PopupOptions

弹出框选项

Properties

Style

样式

Properties

Transition

过渡

Properties

Light

光照

Properties

Fog

Properties

Sources

数据源

PromoteIdSpecification

ID提升规范

Type: ({: string} | string)

AnySourceData

数据源

Type: (GeoJSONSourceRaw | VideoSourceRaw | ImageSourceRaw | CanvasSourceRaw | VectorSource | RasterSource | RasterDemSource | CustomSourceInterface<(HTMLImageElement | ImageData | ImageBitmap)>)

VectorSourceImpl

Extends VectorSource

矢量数据源
继承VectorSource

Properties

AnySourceImpl

任意数据源

Type: (GeoJSONSource | VideoSource | ImageSource | CanvasSource | VectorSourceImpl | RasterSource | RasterDemSource | CustomSource<(HTMLImageElement | ImageData | ImageBitmap)>)

Source

数据源

Properties

  • type ("vector" | "raster" | "raster-dem" | "geojson" | "image" | "video" | "canvas" | "custom") 数据源类型

GeoJSONSourceRaw

Extends Source, GeoJSONSourceOptions

GeoJSON数据源
继承GeoJSONSourceOptions
实现Source

Properties

  • type ("geojson") 数据源类型

GeoJSONSource

GeoJSON数据源
实现GeoJSONSourceRaw

type

数据源类型

Type: "geojson"

constructor

构造函数

Parameters

setData

设置数据

Parameters

  • data (GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry> | String)

Returns this

getClusterExpansionZoom

获取聚合扩展缩放级别

Parameters

  • clusterId number
  • callback function (error: any, zoom: number): void

Returns this

getClusterChildren

获取聚合子元素

Parameters

  • clusterId number
  • callback function (error: any, features: Array<GeoJSON.Feature<GeoJSON.Geometry>>): void

Returns this

getClusterLeaves

获取聚合叶子元素

Parameters

  • cluserId number
  • limit number
  • offset number
  • callback function (error: any, features: Array<GeoJSON.Feature<GeoJSON.Geometry>>): void

Returns this

GeoJSONSourceOptionsData

GeoJSON数据源选项

Type: (GeoJSON.Feature<GeoJSON.Geometry> | GeoJSON.FeatureCollection<GeoJSON.Geometry> | GeoJSON.Geometry | string | undefined)

Examples

javascript
type GeoJSONSourceOptionsData =
 | GeoJSON.Feature<GeoJSON.Geometry>
 | GeoJSON.FeatureCollection<GeoJSON.Geometry>
 | GeoJSON.Geometry
 | string
 | undefined

GeoJSONSourceOptions

GeoJSON数据源选项

Properties

VideoSourceRaw

Extends Source, VideoSourceOptions

视频数据源
继承VideoSourceOptions
继承Source

Properties

  • type ("video") 数据源类型

VideoSource

视频数据源
实现VideoSourceRaw

type

数据源类型

Type: "video"

constructor

创建VideoSource实例

Parameters

getVideo

获取HTMLVideoElement

Returns HTMLVideoElement

setCoordinates

设置坐标

Parameters

Returns this

VideoSourceOptions

视频数据源选项

Properties

ImageSourceRaw

Extends Source, ImageSourceOptions

图片数据源
继承ImageSourceOptions
继承Source

Properties

  • type ("image") 数据源类型

ImageSource

图片数据源
实现ImageSourceRaw

type

数据源类型

Type: "image"

constructor

创建ImageSource实例

Parameters

updateImage

更新图片

Parameters

Returns this

setCoordinates

设置坐标

Parameters

Returns this

ImageSourceOptions

图片数据源选项

Properties

CanvasSourceRaw

Extends Source, CanvasSourceOptions

画布数据源
继承Source 继承CanvasSourceOptions

Properties

  • type ("canvas") 数据源类型

CanvasSource

画布数据源
实现CanvasSourceRaw

type

数据源类型

Type: "canvas"

coordinates

坐标

Type: Array<Array<number>>

canvas

画布元素

Type: (string | HTMLCanvasElement)

play

播放画布

Returns void

pause

暂停画布

Returns void

getCanvas

获取HTMLCanvasElement

Returns HTMLCanvasElement

setCoordinates

设置坐标

Parameters

Returns this

CanvasSourceOptions

画布数据源选项

Properties

CameraFunctionSpecification

相机函数规范

Type: ({type: "exponential", stops: Array<[number, T]>} | {type: "interval", stops: Array<[number, T]>})

ExpressionSpecification

表达式规范

Type: Array<any>

PropertyValueSpecification

属性值规范

Type: (T | CameraFunctionSpecification<T> | ExpressionSpecification)

TerrainSpecification

地形规范

Properties

SourceVectorLayer

用于矢量图层的源

Type: {id: string, fields: Record<string, string>?, description: string?, minzoom: number?, maxzoom: number?, source: string?, source_name: string?}

Properties

VectorSource

矢量源选项 继承Source

Properties

RasterSource

栅格源 继承Source

Properties

RasterDemSource

栅格DEM源 继承Source

Properties

CustomSourceInterface

自定义源

Properties

CustomSource

自定义数据源 继承Source

Properties

Alignment

对齐方式

Type: ("map" | "viewport" | "auto")

MarkerOptions

标记选项

Properties

EventedListener

事件监听器

Type: function (object: Object): any

StyleOptions

样式选项

Properties

MapboxGeoJSONFeature

Mapbox GeoJSON要素

Type: MapboxGeoJSONFeature

Examples

javascript
type MapboxGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
 layer: Layer
 source: string
 sourceLayer: string
 state: { [key: string]: any }
}

EventData

事件data

Type: {: any}

Properties

  • `` any

Examples

javascript
type EventData = { [key: string]: any }

MapboxEvent

Mapbox事件

type

事件类型

Type: string

target

事件目标

Type: Map

originalEvent

原始事件

Type: TOrig

MapMouseEvent

地图鼠标事件 继承MapboxEvent

type

鼠标事件类型

Type: ("mousedown" | "mouseup" | "click" | "dblclick" | "mousemove" | "mouseover" | "mouseenter" | "mouseleave" | "mouseout" | "contextmenu")

point

鼠标事件发生的点

Type: Point

lngLat

鼠标事件发生的经纬度

Type: LngLat

preventDefault

阻止默认行为

Returns void

defaultPrevented

是否阻止了默认行为

Type: boolean

MapLayerMouseEvent

地图图层鼠标事件

Type: MapLayerMouseEvent

Examples

javascript
type MapLayerMouseEvent = MapMouseEvent & {
 features?: MapboxGeoJSONFeature[]
}

MapTouchEvent

地图触摸事件 继承MapboxEvent

type

触摸事件类型

Type: ("touchstart" | "touchend" | "touchcancel")

point

触摸事件发生的点

Type: Point

lngLat

触摸事件发生的经纬度

Type: LngLat

points

触摸事件发生的所有点

Type: Array<Point>

lngLats

触摸事件发生的所有经纬度

Type: Array<LngLat>

preventDefault

阻止默认行为

Returns void

defaultPrevented

是否阻止了默认行为

Type: boolean

MapLayerTouchEvent

地图图层触摸事件

Type: MapLayerTouchEvent

Examples

javascript
type MapLayerTouchEvent = MapTouchEvent & {
 features?: MapboxGeoJSONFeature[]
}

MapWheelEvent

地图滚轮事件 继承MapboxEvent

type

滚轮事件类型

Type: "wheel"

preventDefault

阻止默认行为

Returns void

defaultPrevented

是否阻止了默认行为

Type: boolean

MapBoxZoomEvent

地图框选事件 继承MapboxEvent

Properties

  • type ("boxzoomstart" | "boxzoomend" | "boxzoomcancel") 框选事件类型
  • boxZoomBounds LngLatBounds 框选的经纬度范围

MapDataEvent

地图数据事件

Type: (MapSourceDataEvent | MapStyleDataEvent)

MapStyleDataEvent

地图样式数据事件 继承MapboxEvent

Properties

  • dataType ("style") 数据类型

MapSourceDataEvent

地图源数据事件 继承MapboxEvent

Properties

  • dataType ("source") 数据类型
  • isSourceLoaded boolean 地图源是否已加载
  • source Source 地图源
  • sourceId string 地图源ID
  • sourceDataType ("metadata" | "content") 数据类型
  • tile any 瓦片
  • coord Coordinate 坐标

Coordinate

坐标

Properties

CanonicalCoordinate

规范化坐标

Properties

MapContextEvent

地图WebGL上下文事件 继承MapboxEvent

Properties

  • type ("webglcontextlost" | "webglcontextrestored") 事件类型

ErrorEvent

地图错误事件 继承MapboxEvent

type

事件类型

Type: "error"

error

错误对象

Type: Error

FilterOptions

用于过滤的选项

Properties

AnimationOptions

动画选项

Properties

CameraOptions

相机选项

Properties

CameraForBoundsOptions

用于边界的相机选项 继承CameraOptions

Properties

CameraForBoundsOptions

用于边界的相机选项
继承CameraOptions

Properties

CameraForBoundsResult

用于边界的相机结果

Type: CameraForBoundsResult

Examples

javascript
type CameraForBoundsResult = Required<
   Pick<CameraOptions, "zoom" | "bearing">
 > & {
   center: { lng: number; lat: number }
 }

FlyToOptions

用于飞行动画的相机选项
继承AnimationOptions
继承CameraOptions

Properties

EaseToOptions

用于缓动动画的相机选项
继承AnimationOptions
继承CameraOptions

Properties

FitBoundsOptions

用于适应边界的相机选项
继承FlyToOptions

Properties

MapEventType

地图事件类型

Type: {error: ErrorEvent, load: MapboxEvent, idle: MapboxEvent, remove: MapboxEvent, render: MapboxEvent, resize: MapboxEvent, webglcontextlost: MapContextEvent, webglcontextrestored: MapContextEvent, dataloading: MapDataEvent, data: MapDataEvent, tiledataloading: MapDataEvent, sourcedataloading: MapSourceDataEvent, styledataloading: MapStyleDataEvent, sourcedata: MapSourceDataEvent, styledata: MapStyleDataEvent, boxzoomcancel: MapBoxZoomEvent, boxzoomstart: MapBoxZoomEvent, boxzoomend: MapBoxZoomEvent, touchcancel: MapTouchEvent, touchmove: MapTouchEvent, touchend: MapTouchEvent, touchstart: MapTouchEvent, click: MapMouseEvent, contextmenu: MapMouseEvent, dblclick: MapMouseEvent, mousemove: MapMouseEvent, mouseup: MapMouseEvent, mousedown: MapMouseEvent, mouseout: MapMouseEvent, mouseover: MapMouseEvent, movestart: MapboxEvent<(MouseEvent | TouchEvent | WheelEvent | undefined)>, move: MapboxEvent<(MouseEvent | TouchEvent | WheelEvent | undefined)>, moveend: MapboxEvent<(MouseEvent | TouchEvent | WheelEvent | undefined)>, zoomstart: MapboxEvent<(MouseEvent | TouchEvent | WheelEvent | undefined)>, zoom: MapboxEvent<(MouseEvent | TouchEvent | WheelEvent | undefined)>, zoomend: MapboxEvent<(MouseEvent | TouchEvent | WheelEvent | undefined)>, rotatestart: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, rotate: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, rotateend: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, dragstart: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, drag: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, dragend: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, pitchstart: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, pitch: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, pitchend: MapboxEvent<(MouseEvent | TouchEvent | undefined)>, wheel: MapWheelEvent}

Properties

MapLayerEventType

地图图层事件类型

Type: {click: MapLayerMouseEvent, dblclick: MapLayerMouseEvent, mousedown: MapLayerMouseEvent, mouseup: MapLayerMouseEvent, mousemove: MapLayerMouseEvent, mouseenter: MapLayerMouseEvent, mouseleave: MapLayerMouseEvent, mouseover: MapLayerMouseEvent, mouseout: MapLayerMouseEvent, contextmenu: MapLayerMouseEvent, touchstart: MapLayerTouchEvent, touchend: MapLayerTouchEvent, touchcancel: MapLayerTouchEvent}

Properties

AnyLayout

任意图层布局

Type: (BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout | HeatmapLayout | HillshadeLayout | SkyLayout)

AnyPaint

任意图层绘制

Type: (BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint | HeatmapPaint | HillshadePaint | SkyPaint)

Layer

地图图层

Properties

BackgroundLayer

背景图层 继承Layer

Properties

TCircleLayer

圆形图层 继承Layer

Properties

FillExtrusionLayer

填充拉伸图层 继承Layer

Properties

FillLayer

填充图层 继承Layer

Properties

THeatmapLayer

热力图层 继承Layer

Properties

HillshadeLayer

遮蔽山地图层 继承Layer

Properties

LineLayer

线图层 继承Layer

Properties

TRasterLayer

栅格图层 继承Layer

Properties

TSymbolLayer

符号图层 继承Layer

Properties

SkyLayer

天空图层 继承Layer

Properties

AnyLayer

任意图层

Type: (BackgroundLayer | TCircleLayer | FillExtrusionLayer | FillLayer | THeatmapLayer | HillshadeLayer | LineLayer | TRasterLayer | TSymbolLayer | CustomLayerInterface | SkyLayer)

CustomLayerInterface

自定义图层接口

Properties

StyleFunction

样式函数

Properties

Visibility

可见性

Type: ("visible" | "none")

Layout

布局

Properties

BackgroundLayout

背景布局 继承Layout

BackgroundPaint

背景画笔

Properties

FillLayout

填充布局 继承Layout

Properties

FillPaint

填充画笔

Properties

FillExtrusionLayout

用于填充立体建筑物的样式 继承Layout

FillExtrusionPaint

用于填充立体建筑物的样式

Properties

LineLayout

用于线条的样式 继承Layout

Properties

LinePaint

用于线条的绘制样式

Properties

SymbolLayout

符号布局 继承Layout

Properties

SymbolPaint

符号绘制样式

Properties

RasterLayout

矢量栅格图层布局 继承Layout

RasterPaint

矢量栅格图层绘制

Properties

CircleLayout

圆形图层布局 继承Layout

Properties

CirclePaint

圆形图层绘制

Properties

HeatmapLayout

热力图图层布局 继承Layout

HeatmapPaint

热力图绘制样式

Properties

HillshadeLayout

山体阴影图层布局 继承Layout

HillshadePaint

山体阴影绘制样式

Properties

SkyLayout

天空图层布局 继承Layout

SkyPaint

用于设置天空的绘制样式

Properties

ElevationQueryOptions

用于设置获取高程的参数

Type: {exaggerated: boolean}

Properties

Projection

用于设置地图投影方式的参数

Properties