ElevationTrend 海拔趋势分析
简介
海拔趋势分析用于沿一条路径提取连续高程数据,并生成海拔变化曲线,用以展示路线的爬升、下降趋势。在 Cesium 中,该功能可辅助评估道路或管线的坡度变化,常应用于登山路线规划、交通设计、排水系统布局等需要考虑地势起伏的场景。
演练场
引入
ts
import { ElevationTrend } from "@m-tech/gis-core";
new ElevationTrend(viewer, options);参数
| 参数名 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
viewer | Viewer | 是 | - | 容器 |
options | Object | 是 | {} | 配置 |
options.positions | Position[] | 是 | - | 位置 |
options.lerp | boolean | 否 | true | 是否插值,开启后会在点与点之间插值, 使曲线更均匀平滑 |
options.accuracy | number | 否 | 10 | 插值精度(m) |
方法
initChart(echarts: ECharts, chartDom: HTMLElement | string, options: any = {})
echarts 图表数据可视化。
参数
| 参数名 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
echarts | ECharts | 是 | - | ECharts 类 |
chartDom | HTMLElement | string | 是 | - | 图表容器 |
options | any | 否 | {} | echarts图表配置 |
clear()
清除分析。
示例
ts
import * as echarts from "echarts";
import { ElevationTrend, Position } from "@m-tech/gis-core";
// 初始化海拔趋势分析
const elevationTrend = new ElevationTrend(viewer, {
positions: [
new Position(114.218, 30.579, 100),
new Position(114.214, 30.57, 100),
new Position(114.21, 30.561, 100),
],
lerp: true,
accuracy: 10,
});
// 初始化图表
elevationTrend.initChart(echarts, "chartDom", {
title: {
text: "海拔趋势",
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
});
// 清除海拔趋势分析
elevationTrend.clear();