工具函数
类型 / 参数 / 返回值 / 用法 · 右侧为本页导航
自定义 本库 API
OL OpenLayers
融合 自定义与 OL 混用
工具函数
全局 API · transformCoord
transformCoord(data, from, to, projectionCode?)
- 类型:
Function - 归属:自定义
- 参数:
{number[]} data—[x, y]{string} from—'wgs84'|'gcj02'|'webmercator'|'map'…{string} to— 同上{string|Object} [projectionCode]— 自定义投影
- 返回值:
number[] - 说明:内部
new Transform(...)。from/to为'map'时依赖当前context中的 Map。 - 用法:
import { transformCoord } from '@its-cool/simple-map';
const gcj = transformCoord([120.15, 30.28], 'wgs84', 'gcj02');
const merc = transformCoord(gcj, 'gcj02', 'webmercator');
示例页:/transform
全局 API · mapTools
mapTools.pipeInspection(options)
- 类型:
Function - 参数:
{Object} options{number} options.wkid—3857时会把坐标toWgs84{Array<{x,y}>} options.list— 轨迹折线{string} options.layerIds— WFS typeName{Function} options.callback(featuresProps[])— 结果回调{Object} [options.cql]— 额外 CQL 条件键值
- 返回值:无(异步
fetch) - 用法:
import { mapTools } from '@its-cool/simple-map';
mapTools.pipeInspection({
wkid: 3857,
list: [{ x: 13528400, y: 3676400 }, { x: 13528500, y: 3676500 }],
layerIds: 'water:pipe',
callback(rows) {
console.log(rows);
}
});