主题
AnalysisFacade — 分析子门面
通过 app.analysis 访问空间分析功能。
buffer(geometry, distance, options)
缓冲区分析。
ts
buffer(geometry: unknown, distance: number, options?: object): unknown| 参数 | 类型 | 描述 |
|---|---|---|
| geometry | object | 输入几何 |
| distance | number | 缓冲距离 |
| options | object | 附加选项(如 { units: 'meters' }) |
ts
const buffered = app.analysis.buffer(
{ type: 'Point', coordinates: [116, 39] },
1000
);overlay(geometries, mode)
叠加分析。
ts
overlay(geometries: unknown[], mode: string): unknown| 参数 | 类型 | 描述 |
|---|---|---|
| geometries | unknown[] | 输入几何数组 |
| mode | string | 叠加模式('union'、'intersect'、'difference') |
ts
const result = app.analysis.overlay([geom1, geom2], 'union');clip(geometry, clip)
裁剪分析。
ts
clip(geometry: unknown, clip: unknown): unknown| 参数 | 类型 | 描述 |
|---|---|---|
| geometry | unknown | 被裁剪几何 |
| clip | unknown | 裁剪区域几何 |
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] | 查询点 |
| layer | string | LayerRef | 目标图层 |
| k | number | 返回最近的 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[]| 参数 | 类型 | 描述 |
|---|---|---|
| source | string | LayerRef | 源图层 |
| target | string | LayerRef | 目标图层 |
| predicate | string | 空间关系谓词('intersects'、'contains'、'within') |
ts
const result = app.analysis.spatialJoin('sourceLayer', 'targetLayer', 'intersects');contour(options)
等值线分析。
ts
contour(options: { data?: unknown; interval?: number }): unknown| 参数 | 类型 | 描述 |
|---|---|---|
| data | unknown | 输入数据 |
| interval | number | 等值线间距 |
ts
const contours = app.analysis.contour({ interval: 100 });voronoi(points, extent)
泰森多边形分析。
ts
voronoi(points: Coordinate[], extent: Extent): unknown| 参数 | 类型 | 描述 |
|---|---|---|
| points | Coordinate[] | 输入点数组 |
| extent | Extent | 计算范围 [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] | 终点坐标 |
| options | object | 选项(如 { 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] | 服务中心坐标 |
| breaks | number[] | 时间/距离分段值 |
| options | object | 附加选项 |
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] | 观察者坐标 |
| radius | number | 视域半径 |
| height | number | 观察者高度 |
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] | 终点坐标 |
返回值:
| 字段 | 类型 | 说明 |
|---|---|---|
| visible | boolean | 两点是否通视 |
| points | Coordinate[] | 视线上的采样点 |
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| 参数 | 类型 | 描述 |
|---|---|---|
| line | GeoJSON LineString | 剖面线几何 |
| options | object | 附加选项 |
ts
const points = app.analysis.profile({
type: 'LineString',
coordinates: [[0, 0], [1, 1], [2, 2]],
});