Skip to content

AnalysisFacade — 分析子门面

通过 app.analysis 访问空间分析功能。

buffer(geometry, distance, options)

缓冲区分析。

ts
buffer(geometry: unknown, distance: number, options?: object): unknown
参数类型描述
geometryobject输入几何
distancenumber缓冲距离
optionsobject附加选项(如 { units: 'meters' }
ts
const buffered = app.analysis.buffer(
  { type: 'Point', coordinates: [116, 39] },
  1000
);

overlay(geometries, mode)

叠加分析。

ts
overlay(geometries: unknown[], mode: string): unknown
参数类型描述
geometriesunknown[]输入几何数组
modestring叠加模式('union''intersect''difference'
ts
const result = app.analysis.overlay([geom1, geom2], 'union');

clip(geometry, clip)

裁剪分析。

ts
clip(geometry: unknown, clip: unknown): unknown
参数类型描述
geometryunknown被裁剪几何
clipunknown裁剪区域几何
ts
const clipped = app.analysis.clip(polygonGeom, clipGeom);

nearest(point, layer, k)

最近邻分析。

ts
nearest(point: Coordinate, layer: string | LayerRef, k: number): FeatureRef[]
参数类型描述
point[number, number]查询点
layerstring | LayerRef目标图层
knumber返回最近的 k 个要素
ts
const nearest = app.analysis.nearest([116, 39], 'myLayer', 5);

spatialJoin(source, target, predicate)

空间连接分析。

ts
spatialJoin(source: string | LayerRef, target: string | LayerRef, predicate: string): FeatureRef[]
参数类型描述
sourcestring | LayerRef源图层
targetstring | LayerRef目标图层
predicatestring空间关系谓词('intersects''contains''within'
ts
const result = app.analysis.spatialJoin('sourceLayer', 'targetLayer', 'intersects');

contour(options)

等值线分析。

ts
contour(options: { data?: unknown; interval?: number }): unknown
参数类型描述
dataunknown输入数据
intervalnumber等值线间距
ts
const contours = app.analysis.contour({ interval: 100 });

voronoi(points, extent)

泰森多边形分析。

ts
voronoi(points: Coordinate[], extent: Extent): unknown
参数类型描述
pointsCoordinate[]输入点数组
extentExtent计算范围 [minX, minY, maxX, maxY]
ts
const polygons = app.analysis.voronoi(
  [[116, 39], [121, 31], [113, 23]],
  [110, 20, 125, 45]
);

shortestPath(from, to, options)

最短路径分析。

ts
shortestPath(from: Coordinate, to: Coordinate, options?: object): unknown
参数类型描述
from[number, number]起点坐标
to[number, number]终点坐标
optionsobject选项(如 { weight: 'distance' }
ts
const path = app.analysis.shortestPath([116, 39], [121, 31]);

serviceArea(center, breaks, options)

服务区分析。

ts
serviceArea(center: Coordinate, breaks: number[], options?: object): unknown
参数类型描述
center[number, number]服务中心坐标
breaksnumber[]时间/距离分段值
optionsobject附加选项
ts
const areas = app.analysis.serviceArea([116, 39], [300, 600, 900]);

viewshed(observer, options)

视域分析。

ts
viewshed(observer: Coordinate, options?: { radius?: number; height?: number }): unknown
参数类型描述
observer[number, number]观察者坐标
radiusnumber视域半径
heightnumber观察者高度
ts
const viewshed = app.analysis.viewshed([116, 39], { radius: 5000, height: 100 });

lineOfSight(a, b)

通视分析。

ts
lineOfSight(a: Coordinate, b: Coordinate): { visible: boolean; points: Coordinate[] }
参数类型描述
a[number, number]起点坐标
b[number, number]终点坐标

返回值:

字段类型说明
visibleboolean两点是否通视
pointsCoordinate[]视线上的采样点
ts
const result = app.analysis.lineOfSight([116, 39], [121, 31]);
// result.visible === true
// result.points: [[116, 39], [121, 31]]

profile(line, options)

剖面分析。

ts
profile(line: unknown, options?: object): unknown
参数类型描述
lineGeoJSON LineString剖面线几何
optionsobject附加选项
ts
const points = app.analysis.profile({
  type: 'LineString',
  coordinates: [[0, 0], [1, 1], [2, 2]],
});

四川省交通运输综合地理服务平台 地图开发框架