Class: Map

Map

GeoGlobe.Map类。

new Map(options)

Parameters:
Name Type Description
options Object 地图对象相关选项设置。
Properties
Name Type Description
mapCRS Object 坐标参考系统
Properties
Name Type Description
topTileExtent Array 顶层瓦片范围
coordtransform function 自定义坐标变换函数
resolutions Array 栅格瓦片金字塔分辨率,0-22级,不足以null补全,例:[null,null,105,52,23,...]
tileSize Int 栅格瓦片大小,缺省则默认256
epsg String 地图epsg号。默认"EPSG:3857"
units String 地图单位。默认"degrees"。可能的值有"degrees","m"。Xian80、Beijing54地方坐标系设置"m"。
isIntScrollZoom Boolean 缩放级别是否为整数处理模式
renderWorldCopies Boolean 是否渲染世界多个副本
container HTMLElement | string 将在其中呈现地图的HTML元素,或元素的字符串ID
style Object | string 地图的样式。必须是符合样式规范中描述的模式的JSON对象,或者是此类JSON的URL
center LngLat | Array 地图的初始地理中心点
zoom Number 地图的初始缩放级别,默认为0
bearing Number 地图的初始方位(旋转),默认为0
pitch Number 地图的初始俯仰(倾斜),默认为0
xxx 更多属性参见Members
Source:
View2D/map/Map.js
Example
var simple = {
    "version": 8,
    "source": {
        "geostar": {
            "type": "raster",
            "tiles": ["http://t2.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}"],
            "tileSize": 256
        },
        "layers": [
            {
                "id": "1",
                "type": "raster",
                "source": "geostar",
                "raster-opacity": 1
            }
        ]
    }
};
 var map = new GeoGlobe.Map({
    style: simple,
    container: 'map',
    zoom: 4,
    center: [112.939, 31.377],
    isAttributionControl: false
});

Members


attributionControl :Boolean

如果为true,则会将AttributionControl添加到地图中
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

bearing :Int

旋转程度
Type:
  • Int
Default Value:
  • 0
Source:
View2D/map/Map.js

bearingSnap :Int

捕捉北方向的极限值,单位是度
Type:
  • Int
Default Value:
  • 7
Source:
View2D/map/Map.js

boxZoom :Boolean

如果为true,则启用“框缩放”交互(请参阅BoxZoomHandler)
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

center :GeoGlobe.LonLat

地图的中心点坐标
Type:
  • GeoGlobe.LonLat
Default Value:
  • [0,0]
Source:
View2D/map/Map.js

collectResourceTiming :Boolean

如果为true,则会收集由GeoJSON和Vector Tile Web发出的请求资源时间API信息
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/map/Map.js

container :String

地图的容器名称
Type:
  • String
Default Value:
  • null
Source:
View2D/map/Map.js

doubleClickZoom :Boolean

如果为true,则启用“双击放大”交互(请参阅DoubleClickZoomHandler)
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

dragPan :Boolean

如果为true,则“拖动平移”交互被启用(请参阅DragPanHandler)
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

dragRotate :Boolean

如果为true,则“拖动旋转”交互被启用(请参阅DragRotateHandler)
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

epsg :String

获取地图epsg号。默认"EPSG:3857"
Type:
  • String
Source:
View2D/map/Map.js

failIfMajorPerformanceCaveat :Boolean

如果为true,则如果Mapbox GL JS的性能明显低于预期(即将使用软件渲染器),则映射创建将失败
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/map/Map.js

hash :Boolean

地图上的位置(缩放,中心纬度、经度和中心,轴承间距)将同步散列片段的页面的URL
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/map/Map.js

Interactive :Boolean

是否激活外部设备
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

is3Dpitching :Boolean

设置是否倾斜
Type:
  • Boolean
Source:
View2D/map/Map.js

isAttributionControl :Boolean

地图中是否添加属性控件
Type:
  • Boolean
Source:
View2D/map/Map.js

isBooxZoom :Boolean

是否允许范围缩放
Type:
  • Boolean
Source:
View2D/map/Map.js

isDoubleClickZoom :Boolean

双击鼠标左键,是否进行放大地图操作
Type:
  • Boolean
Source:
View2D/map/Map.js

isDragPan :Boolean

是否允许拖拽移动
Type:
  • Boolean
Source:
View2D/map/Map.js

isDragRotate :Boolean

是否允许旋转
Type:
  • Boolean
Source:
View2D/map/Map.js

isIntScrollZoom :Boolean

缩放级别是否为整数处理模式
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/map/Map.js

isKeyboard :Boolean

是否开启键盘,默认为true
Type:
  • Boolean
Source:
View2D/map/Map.js

isScrollZoom :Boolean

是否允许滚动缩放
Type:
  • Boolean
Source:
View2D/map/Map.js

isTouchZoomRotate :Boolean

是否允许触摸旋转缩放
Type:
  • Boolean
Source:
View2D/map/Map.js

isTrackResize :Boolean

地图尺寸改变缩放自动响应
Type:
  • Boolean
Source:
View2D/map/Map.js

keyboard :Boolean

如果为true,则启用键盘快捷键(请参阅KeyboardHandler)
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

localIdeographFontFamily :String

字体样式
Type:
  • String
Default Value:
  • null
Source:
View2D/map/Map.js

logoPosition :Boolean

mapbox图标在地图上的相对位置
Type:
  • Boolean
Default Value:
  • bottom-left
Source:
View2D/map/Map.js

maxBounds :GeoGlobe.Bounds

地图的最大地理范围
Type:
  • GeoGlobe.Bounds
Default Value:
  • null
Source:
View2D/map/Map.js

maxTileCacheSize :Number

最大瓦片数量
Type:
  • Number
Default Value:
  • null
Source:
View2D/map/Map.js

maxZoom :Int

地图的最大级别
Type:
  • Int
Default Value:
  • 22
Source:
View2D/map/Map.js

minzoom :Int

地图的最小级别
Type:
  • Int
Default Value:
  • 0
Source:
View2D/map/Map.js

pitch :Int

倾斜程度
Type:
  • Int
Default Value:
  • 0
Source:
View2D/map/Map.js

pitch3Dzoom :Int

可选,3D倾斜层级,默认为16
Type:
  • Int
Source:
View2D/map/Map.js

pitchWithRotate :Boolean

如果为false,则会禁用“拖动旋转”交互的地图的俯仰(倾斜)控制
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

preserveDrawingBuffer :Boolean

地图可以导出为PNG使用地图
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/map/Map.js

refreshExpiredTiles :Boolean

如果为false,那么地图将不会尝试重新请求瓦片
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

renderWorldCopies :Boolean

绘制地图副本
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

repaint :Boolean

是否将不断重绘地图
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

scrollZoom :Boolean|Object

如果为true,则启用“滚动缩放”交互。Object值作为选项传递给ScrollZoomHandler#enable
Type:
  • Boolean | Object
Default Value:
  • true
Source:
View2D/map/Map.js

showCollisionBoxes :Boolean

是否渲染数据周围的边框
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

showTileBoundaries :Boolean

是否在每一个瓦片周围绘制一个轮廓
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/map/Map.js

skipLevelOfZooming :Boolean

设置是否处理快速缩放时的注记图层显示的体验问题
Type:
  • Boolean
Source:
View2D/map/Map.js

style :Object|String

地图的Mapbox样式。 这必须是符合Mapbox样式规范中描述的模式的JSON对象,或者是此类JSON的URL。
Type:
  • Object | String
Source:
View2D/map/Map.js

touchZoomRotate :Boolean|Object

如果为true,则启用“点击缩放旋转”交互。 Object值作为选项传递给TouchZoomRotateHandler#enable
Type:
  • Boolean | Object
Default Value:
  • true
Source:
View2D/map/Map.js

trackResize :Boolean

如果为true,则当浏览器窗口调整大小时,地图将自动调整大小
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/map/Map.js

transformRequest :function

转换请求
Type:
  • function
Default Value:
  • null
Source:
View2D/map/Map.js

units :String

获取地图单位。默认"degrees"。可能的值有"degrees","m"
Type:
  • String
Source:
View2D/map/Map.js

zoom :Int

地图的当前级别
Type:
  • Int
Default Value:
  • 0
Source:
View2D/map/Map.js

Methods


addCanvasLayer(canvaslayer)

添加canvas图层
Parameters:
Name Type Description
canvaslayer Object canvas图层
Source:
View2D/map/Map.js

addClass(class)

添加class
Parameters:
Name Type Description
class String 添加的class.
Source:
View2D/map/Map.js

addControl(control, position)

添加单个控件
Parameters:
Name Type Description
control Control 控件对象.
position String 添加的控件的位置,包括'top-left' , 'top-right' , 'bottom-left' , and 'bottom-right' . 默认 'top-right' .
Source:
View2D/map/Map.js

addLayer(layer, before)

添加图层。
Parameters:
Name Type Description
layer Object 二维视图图层对象.
before String 指定图层顺序
Source:
View2D/map/Map.js

addLayer(layer)

添加图层
Parameters:
Name Type Description
layer Object 图层.
Source:
View2D/map/Map.js

addLayers(layers)

添加多个图层
Parameters:
Name Type Description
layers Array 图层组
Source:
View2D/map/Map.js

addSource(id, source)

地图样式添加来源。
Parameters:
Name Type Description
id String 源id.
source Object 数据源对象.
Source:
View2D/map/Map.js

areTilesLoaded()

判断瓦片是否加载完全。
Source:
View2D/map/Map.js
Returns:
瓦片是否加载完全
Type
Boolean

easeTo(options, eventData)

有过渡的改变地图属性
Parameters:
Name Type Description
options Object 中心点、缩放、旋转、倾斜等.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

fitBounds(bounds, options, eventData)

平移和缩放地图到适合的范围.
Parameters:
Name Type Description
bounds GeoGlobe.LngLatbounds 适合的范围.
options Object 平移、缩放参数选项
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

flyTo(options, eventData)

沿着引起飞行的曲线对过渡进行动画处理
Parameters:
Name Type Description
options Object 中心点、缩放、旋转、倾斜等.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

getBearing()

获取当前地图旋转程度
Source:
View2D/map/Map.js
Returns:
bearing -地图旋转程度
Type
Int

getBounds()

获取地图地理范围
Source:
View2D/map/Map.js
Returns:
地图的地理范围
Type
GeoGlobe.LngLatBounds

getCanvas()

获取画布元素
Source:
View2D/map/Map.js
Returns:
canvas -画布元素
Type
HTMLElement

getCanvasContainer()

获取地图容器的html元素
Source:
View2D/map/Map.js
Returns:
container -地图容器中画布元素
Type
HTMLElement

getCenter()

获取地图中心点坐标
Source:
View2D/map/Map.js
Returns:
地图中心点坐标
Type
GeoGlobe.LngLat

getClasses()

获取style的class
Source:
View2D/map/Map.js
Returns:
返回style的class
Type
String

getContainer()

获取地图容器的html元素
Source:
View2D/map/Map.js
Returns:
container -地图容器
Type
HTMLElement

getFilter(layer)

获取图层过滤
Parameters:
Name Type Description
layer String 要过滤的图层id.
Source:
View2D/map/Map.js
Returns:
图层过滤条件
Type
Filter

getLayer(id)

获取指定ID图层对象
Parameters:
Name Type Description
id String 要获取的图层id.
Source:
View2D/map/Map.js
Returns:
指定ID的图层;如果该ID对应于不存在的层则返回未定义.
Type
Object | Undefined

getLayer(id)

获取图层
Parameters:
Name Type Description
id Object 图层id
Source:
View2D/map/Map.js

getLayerContainer(className)

获取图层容器
Parameters:
Name Type Description
className String 图层容器className
Source:
View2D/map/Map.js

getLayoutProperty(layer, name)

获取指定样式层的布局属性
Parameters:
Name Type Description
layer String 要过滤的图层id.
name String 布局属性名.
Source:
View2D/map/Map.js
Returns:
- 图层布局属性
Type
Object

getLight()

获取亮度属性.
Source:
View2D/map/Map.js
Returns:
返回style中亮度属性
Type
Object

getMaxBounds()

获取地图最大地理范围
Source:
View2D/map/Map.js
Returns:
地图限制的最大边界,如果没有设置,则返回null
Type
GeoGlobe.LngLatBounds | null

getMaxZoom()

获取地图的最大级别
Source:
View2D/map/Map.js
Returns:
maxZoom -地图的最大级别
Type
Number

getMinZoom()

获取地图的最小级别
Source:
View2D/map/Map.js
Returns:
zoom -地图的最大级别
Type
number

getPaintProperty(layer, name)

获取指定样式层的绘画属性
Parameters:
Name Type Description
layer String 要过滤的图层id.
name String 绘图属性名.
Source:
View2D/map/Map.js
Returns:
图层绘画的属性
Type
Object

getPitch()

获取当前地图的倾斜程度
Source:
View2D/map/Map.js
Returns:
pitch -倾斜程度
Type
Int

getRenderWorldCopies()

是否产生地图副本
Source:
View2D/map/Map.js
Returns:
true or false
Type
Boolean

getResolutionForLevel(level, tileSize)

根据层级获取分辨率
Parameters:
Name Type Description
level Int 层级.
tileSize Int 瓦片大小.
Source:
View2D/map/Map.js

getResolutions()

获取地图分辨率
Source:
View2D/map/Map.js

getSource(id)

获取地图样式中指定id的源
Parameters:
Name Type Description
id String 源id.
Source:
View2D/map/Map.js
Returns:
获取指定id的数据源或者undefined
Type
Object

getStyle()

获取指定地图样式对象。
Source:
View2D/map/Map.js
Returns:
style -地图样式对象
Type
Object

getZoom()

获取地图当前级别
Source:
View2D/map/Map.js
Returns:
地图当前级别
Type
Int

hasClasses(klasses)

替换class
Parameters:
Name Type Description
klasses String 设置的class.
Source:
View2D/map/Map.js
Returns:
判断map是否有指定的class
Type
Boolean

hasImage(id)

图片是否增加
Parameters:
Name Type Description
id String 源id.
Source:
View2D/map/Map.js
Returns:
返回判断结果
Type
Boolean

isloaded()

判断地图是否加载完全
Source:
View2D/map/Map.js
Returns:
地图是否加载完全.
Type
Boolean

isMoving()

判断镜头是否移动
Source:
View2D/map/Map.js
Returns:
镜头是否移动
Type
Boolean

isRotating()

判断镜头是否移动
Source:
View2D/map/Map.js
Returns:
地图是否旋转
Type
Boolean

isSourceLoaded(id)

判断数据源是否加载完全。
Parameters:
Name Type Description
id String 源id.
Source:
View2D/map/Map.js
Returns:
数据源是否加载完全
Type
Boolean

isStyleLoaded()

判断地图样式是否加载完毕
Source:
View2D/map/Map.js
Returns:
布尔值,代表样式是否已完全加载。
Type
Boolean

isZooming()

判断镜头是否移动
Source:
View2D/map/Map.js
Returns:
镜头是否缩放
Type
Boolean

jumpTo(options, eventData)

无过渡的改变地图属性
Parameters:
Name Type Description
options Object 中心点、缩放、旋转、倾斜等.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

loaded()

判断地图是否完全加载
Source:
View2D/map/Map.js
Returns:
地图是否加载完全.
Type
Boolean

loadImage(URL, callback)

从外部加载图片
Parameters:
Name Type Description
URL String 图片URL地址
callback function 下载函数时触发的回调函数
Source:
View2D/map/Map.js

loadSprite(sprite, imgPrefix)

加载sprite文件
Parameters:
Name Type Description
sprite String 路径.
imgPrefix String 可选sprite内小图片名称的前缀.
Source:
View2D/map/Map.js

moveLayer(id, beforeId)

移动图层到不同的位置
Parameters:
Name Type Description
id String 移动图层的id.
beforeId String 指定图层的顺序
Source:
View2D/map/Map.js

moveLayer(id, beforeId)

移动图层顺序
Parameters:
Name Type Description
id String 要移动的图层的ID
beforeId String 之前插入新图层的现有图层的ID。如果省略此参数,则新图层将移动到最上层
Source:
View2D/map/Map.js

moveLayerContainer(className, before)

移动图层容器
Parameters:
Name Type Description
className String 图层容器className
before String 图层容器className
Source:
View2D/map/Map.js

off(type, layer, listener)

移除指定图层上的事件侦听器
Parameters:
Name Type Description
type String 事件类型
layer String 指定图层
listener function 事件触发函数
Source:
View2D/map/Map.js

on(type, layer, listener)

在指定类型图层上添加事件侦听器
Parameters:
Name Type Description
type String 事件类型
layer String 指定图层
listener function 事件触发函数
Source:
View2D/map/Map.js

on(type, listener)

为指定类型的事件添加侦听器。
Parameters:
Name Type Description
type String 事件类型
listener function 事件触发函数
Source:
View2D/map/Map.js

panBy(offset, options, eventData)

平移指定像素
Parameters:
Name Type Description
offset PointLike x轴、y轴方向增量.
options AnimationOptions 设置选项.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

panTo(lnglat, options, eventData)

平移到指定地理坐标
Parameters:
Name Type Description
lnglat GeoGlobe.LngLat 地理坐标.
options AnimationOptions 设置选项.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

project(lnglat)

投影到指定位置的坐标点
Parameters:
Name Type Description
lnglat GeoGlobe.LngLat 经纬度投影坐标.
Source:
View2D/map/Map.js
Returns:
Point -坐标像素点
Type
GeoGlobe.Point

queryRenderedFeatures()

获取绘制(可见)Featrues
Source:
View2D/map/Map.js
Returns:
返回GeoJSON 特征对象
Type
Object

querySourceFeatures(sourceID)

获取数据源(所有)Featrues
Parameters:
Name Type Description
sourceID String 要查询的矢量瓦片或GeoJSON源的ID
Source:
View2D/map/Map.js
Returns:
返回GeoJSON 特征对象
Type
Object

remove()

移除所有对象.
Source:
View2D/map/Map.js

removeAllImages()

删除所有的图片符号
Source:
View2D/map/Map.js

removeAllLayers()

删除所有的图层
Source:
View2D/map/Map.js

removeAllSources()

删除所有的source
Source:
View2D/map/Map.js

removeCanvasLayer(canvaslayer)

移除canvas图层
Parameters:
Name Type Description
canvaslayer Object canvas图层
Source:
View2D/map/Map.js

removeClass(klass)

移除class
Parameters:
Name Type Description
klass String 移除class.
Source:
View2D/map/Map.js

removeControl(control)

删除控件
Parameters:
Name Type Description
control GeoGlobe.Control 控件对象.
Source:
View2D/map/Map.js

removeImage(id)

移除指定样式的图片
Parameters:
Name Type Description
id String 图片Id
Source:
View2D/map/Map.js

removeLayer(id)

删除图层
Parameters:
Name Type Description
id String 要删除的图层id.
Source:
View2D/map/Map.js

removeLayer(id)

移除图层
Parameters:
Name Type Description
id String 要移除的图层的ID
Source:
View2D/map/Map.js

removeLayerAndSource(layerid)

删除layer的同时删除与layerid一致的source
Parameters:
Name Type Description
layerid String 图层id.
Source:
View2D/map/Map.js

removeSource(id, image, options)

增加图片
Parameters:
Name Type Description
id String 源id.
image image 图片资源
options any 图片像素设置等
Source:
View2D/map/Map.js

removeSource(id)

移除地图样式的来源。
Parameters:
Name Type Description
id String 源id.
Source:
View2D/map/Map.js

resetNorth(options, eventData)

旋转地图的方位(北)(动画过渡)
Parameters:
Name Type Description
options Object 旋转参数选项
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

resize()

根据容器的大小来调整地图
Parameters:
Type Description
Object
Source:
View2D/map/Map.js

rotateTo(bearing, options, eventData)

旋转到指定程度
Parameters:
Name Type Description
bearing Int 旋转程度.
options Object 旋转参数
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

set3Dzoom(zoom)

设置倾斜的层级
Parameters:
Name Type Description
zoom Int 倾斜的层级,层级在zoom和zoom+1之间的情况下,都会自动倾斜
Source:
View2D/map/Map.js

setBearing(bearing, eventData)

设置地图旋转程度
Parameters:
Name Type Description
bearing Int 旋转程度.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

setCenter(center, eventData)

改变地图中心点坐标.
Parameters:
Name Type Description
center LngLatLike 中心点坐标.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

setClasses(klasses)

替换class
Parameters:
Name Type Description
klasses String 设置的class.
Source:
View2D/map/Map.js

setFilter(layer, filter)

设置图层的过滤
Parameters:
Name Type Description
layer String 要过滤的图层id.
filter Filter 要过滤的条件.
Source:
View2D/map/Map.js

setIs3DPZoom(is3Dpitching)

判断是否倾斜
Parameters:
Name Type Description
is3Dpitching Boolean 是否倾斜,默认为false
Source:
View2D/map/Map.js

setIsConstrain(isConstrain)

设置地图是否在地图边界以内拖动
Parameters:
Name Type Description
isConstrain Boolean 判断地图是否在地图边界以内拖动.
Source:
View2D/map/Map.js

setLayerZoomRange(layerId, minzoom, maxzoom)

设置指定id图层的缩放范围
Parameters:
Name Type Description
layerId String 要过滤的图层id.
minzoom Int 最小级别.
maxzoom Int 最大级别.
Source:
View2D/map/Map.js

setLayoutProperty(layer, name, value)

在指定的样式层中设置布局属性的值
Parameters:
Name Type Description
layer String 要过滤的图层id.
name String 布局属性名.
value String 属性值.
Source:
View2D/map/Map.js

setLight(lightOptions)

设置亮度属性的组合.
Parameters:
Name Type Description
lightOptions Object 亮度属性.
Source:
View2D/map/Map.js

setMaxBounds(lnglatbounds)

设置地图最大地理范围
Parameters:
Name Type Description
lnglatbounds GeoGlobe.LngLatBounds 指定范围.
Source:
View2D/map/Map.js

setMaxzoom(maxzoom)

设置地图的最大级别
Parameters:
Name Type Description
maxzoom Number | Null | Undefined 最大级别.
Source:
View2D/map/Map.js

setMinZoom(minzoom)

设置地图最小级别
Parameters:
Name Type Description
minzoom Number | Null | Undefined 最小级别.
Source:
View2D/map/Map.js

setPaintProperty(layer, name, value)

在指定的样式层中设置一个绘画属性的值
Parameters:
Name Type Description
layer String 要过滤的图层id.
name String 绘图属性名.
value String 属性值.
Source:
View2D/map/Map.js

setPitch(pitch, eventData)

设置地图倾斜程度
Parameters:
Name Type Description
pitch Int 倾斜程度.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

setRenderWorldCopies(renderWorldCopies)

设置当地图缩小时是否产生副本
Parameters:
Name Type Description
renderWorldCopies Boolean 如果为true,则在缩小时会呈现多个世界的副本
Source:
View2D/map/Map.js

setStyle(style, options)

用新值更新地图的Mapbox样式对象。 如果给定的值是样式JSON对象,则将其与地图当前状态进行比较,并仅执行必要的更改以使地图样式与所需状态匹配。
Parameters:
Name Type Description
style StyleSpecification | String | null 符合Mapbox样式规范中描述的模式的JSON对象,或者这样的JSON的URL
options Object 选项设置
Source:
View2D/map/Map.js

setZoom(zoom, eventData)

设置地图到指定级别
Parameters:
Name Type Description
zoom Int 缩放到指定级别.
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

setZoompitch()

设置地图倾斜
Source:
View2D/map/Map.js

snapToNorth(options, eventData)

把地图的轴承为正北
Parameters:
Name Type Description
options Object 参数选项
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

stop()

停止任何动画过渡
Source:
View2D/map/Map.js

unproject(point)

像素点转换为经纬度
Parameters:
Name Type Description
point GeoGlobe.Point 坐标像素点.
Source:
View2D/map/Map.js
Returns:
LngLat -经纬坐标
Type
GeoGlobe.LngLat

ZoomIn(options, eventData)

放大地图级别一级
Parameters:
Name Type Description
options Object 选项
eventData Object 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

zoomTo(zoom, options, eventData)

缩放到指定地图级别
Parameters:
Name Type Description
zoom Int 缩放到指定级别.
options Object 选项
eventData eventData 该参数对象的属性将被添加到,该方法触发的事件回调函数的参数事件对象中
Source:
View2D/map/Map.js

Events


boxcancel

矩形拉框控件的取消事件
Properties:
Name Type Description
data MapBoxEvent
Source:
View2D/handler/BoxHandler3D.js
See:

boxend

矩形拉框控件的结束事件
Type: Object
Properties:
Name Type Description
data MapBoxEvent
Source:
View2D/handler/BoxHandler3D.js
See:

boxstart

矩形拉框控件的开始事件
Properties:
Name Type Description
data MapBoxEvent
Source:
View2D/handler/BoxHandler3D.js
See:

boxzoomcancel

框选缩放地图取消后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

boxzoomend

框选缩放地图结束后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

boxzoomstart

框选缩放地图开始时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

click

单击地图触发的事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

contextmenu

单击鼠标右键触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

data

地图数据更改或者加载时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

dataloading

地图数据下载时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

dblclick

双击地图触发的事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

drag

拖拽地图过程中触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

dragend

拖拽地图结束后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

dragstart

开始拖拽地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

error

发生错误时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

load

所有资源下载完成后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

mousedown

在地图上按下鼠标触发的事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

mouseenter

当鼠标进入指定图层区域触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

mouseleave

当鼠标离开指定图层区域触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

mouseout

当鼠标离开地图画布时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

mouseover

鼠标移到地图上触发的事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

mouseup

在地图上按下并松开鼠标后触发的事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数 -
Source:
View2D/map/Map.js

move

移动地图过程中触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

moveend

移动地图结束后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

movestart

开始移动地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

pitch

倾斜地图过程中触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

pitchend

倾斜地图结束后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

pitchstart

倾斜地图开始时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

remove

移动地图时触发的事件
Source:
View2D/map/Map.js

render

绘制地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

resize

调整地图后触发的事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

rotate

旋转地图过程中触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

rotateend

旋转地图结束后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

rotatestart

旋转地图开始时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

sourcedata

地图的源数据更改或者加载时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

sourcedataloading

地图源数据下载时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

styledata

地图样式更改或者加载时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

styledataloading

地图样式数据下载时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

touchcancel

不触摸地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

touchend

触摸地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

touchmove

移动触摸地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

touchstart

开始触摸地图时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

webglcontextlost

当WebGL上下文丢失时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

webglcontextrestored

当WebGL上下文恢复时启动
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

wheel

鼠标滚轮滚动时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

zoom

点击缩放地图过程中触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

zoomend

点击缩放地图结束后触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js

zoomstart

点击缩放地图开始时触发事件
Properties:
Name Type Description
data Object 事件触发时传递给回调函数的参数
Source:
View2D/map/Map.js