Class: Tool

Tool()

Tool

Constructor

new Tool()

tool类
Source:

Methods

createFeatureFromGeoJson(json, foreachFn) → {Array}

将一个或多个GeoJSON对象转换为几何
Parameters:
Name Type Description
json String | Object | Array.<Object> GeoJSON对象或GeoJSON字符串
foreachFn function 每个几何的回调函数
Source:
Returns:
生成的几何数组
Type
Array

forEachFeatureAtPixel(geometry) → {Array}

查找指定位置
Parameters:
Name Type Description
geometry Geom 覆盖物对象
Source:
Returns:
覆盖物的地理中心坐标[x,y]
Type
Array

getCenterofPixel(map, geometry) → {Array}

获取覆盖物的屏幕坐标
Parameters:
Name Type Description
map map 覆盖物所在的地图对象
geometry Geom 覆盖物对象
Source:
Returns:
覆盖物相对于地图容器左上角点的像素中心坐标[x,y]
Type
Array

getCurrentExtent(map) → {Array}

获取当前地图范围
Parameters:
Name Type Description
map object 必传,地图的map对象
Source:
Returns:
- [xmin, ymin, xmax, ymax]左下角及右上角坐标
Type
Array

loadGeoJsonFromFeature(geometry) → {Object}

将几何导出为GeoJSON
Parameters:
Name Type Description
geometry Object 几何实例
Source:
Returns:
几何的GeoJSON
Type
Object

locateFeature(map, geometry, options)

定位到覆盖物
Parameters:
Name Type Description
map * 覆盖物所在的地图对象
geometry * 覆盖物对象
options * 移动动画的配置项
Source:

transform(fromProjection, toProjection, coordinate) → {*}

将点坐标的坐标系转换,proj4.js中预定义了三个坐标系('EPSG:4326','EPSG:4269','EPSG:3857'),其他的坐标系则需要自己定义
Parameters:
Name Type Description
fromProjection * 源坐标系
toProjection * 目标坐标系
coordinate * 需要转换的坐标值,可以是对象{x:x,y:y},也可以是数组[x,y]
Source:
Returns:
转换后的坐标
Type
*