轨迹简化:按投影容差减少点数并对照距离
对每个线段独立做本地米制投影与迭代 RDP 简化,保留端点与断段关系,并展示简化前后的点数与 WGS84 距离变化。原始文件不被修改。
选择本地轨迹与简化容差
仅支持 GPX / GeoJSON;最大 20 MB、200,000 个坐标点。文件不会上传。
文件只在当前页面内读取,不上传,也不会在刷新后保留。
1 到 100 米,默认 10 米。容差按本地等距投影平面计算,不是测地距离。
简化结果
- 原始点数
- —
- 简化后点数
- —
- 保留点数比例
- —
- 使用容差
- —
- 原始测地距离
- —
- 简化后测地距离
- —
- 距离变化
- —
| 段 | 原点数 | 简化后 | 原距离 | 简化距离 |
|---|
简化版按投影容差生成,输出格式与输入相同;原始文件不会被修改或覆盖。
单段超过 500 公里、跨日界线或纬度超过 85 度时,首版拒绝简化。这类文件仍可用轨迹查看或转换工具处理。
公式与适用条件
这个工具做什么
轨迹简化读取 GPX 或 GeoJSON 线路,在每个线段内部按给定容差去除对形状影响较小的点,生成一个新的简化文件供下载,同时显示简化前后的点数、WGS84 测地距离和逐段对照。它不会修改或覆盖你选择的原始文件。
简化是有损的:被删除的点及其高程不会再出现在输出中;保留下来的点使用原始坐标与原始高程,不做平滑、不重新采样,也不会把断开的线段连接起来。
方法
- 对每个线段分别计算平均纬度,并在该纬度附近做本地等距投影,把经度、纬度换算成米。
- 在这个投影平面上运行迭代版 Ramer–Douglas–Peucker(RDP)算法:先保留首尾点,再反复找出离当前弦最远的点;若距离超过容差就保留它,并把线段在该点处继续拆分。
- 按原始顺序输出保留点,再以 WGS84 椭球逆解重新计算简化前后的距离。
容差是投影平面上的米数,不是测地距离。由于投影是局部近似,远离投影中心时容差与实际地面距离会有细微差别;页面同时报告简化前后的 WGS84 距离,便于判断形状变化是否可接受。RDP 的容差只约束点到弦的偏差,不保证距离变化一定落在同一数值内。
容差与拒绝条件
容差必须为 1 到 100 米,页面初始值为 10 米。文件上限为 20 MB、200,000 个坐标点。首版对以下线段拒绝简化,并指出具体段号:
- 单段投影包围盒对角线超过 500 公里。
- 经度跨度超过 180 度,视为可能跨越日界线。
- 任一点纬度超过 85 度。
这些限制只针对简化。同一文件仍可用轨迹查看读取统计,或用轨迹转换改格式。简化输出保持输入格式;若输入是 GPX,输出仍是 GPX,若输入是 GeoJSON,输出仍是 GeoJSON。
验证算例
赤道附近三点:[0, 0]、[0.001, 0.00005]、[0.002, 0],容差 10 米。中间点相对首尾弦的纬度偏移约 0.00005 度,即约 5.56 米,小于 10 米,因此被移除;输出保留首尾两点。若容差改为 1 米,中间点会被保留。该算例由独立算术核对,不依赖页面脚本自身的输出。
隐私与限制
文件只在浏览器内读取和计算,不上传服务器,也不会在刷新后保留。工具不判断轨迹是否为官方赛道、是否安全或是否适合比赛,简化后的距离也不是赛事丈量。若需要分享文件,建议先检查起点附近是否包含家庭住址等敏感位置。
来源与适用范围
RDP 算法参考 Ramer(1972)与 Douglas–Peucker(1973)的论文记录;坐标与测地距离口径遵循 WGS84 与 core 的 GeographicLib 实现。本文与工具核验日期为 2026-10-27。
实现规范(英文原文)
以下字段用于实现与审阅核对,正文提供中文解释。
- 公式与适用条件
- Simplify each segment independently. Project its coordinates to local metres using an equirectangular approximation around the segment's mean latitude, run an iterative Ramer–Douglas–Peucker pass with the entered tolerance, and keep the original first and last points. Separate segments are not joined. Distances before and after use WGS84 geodesic inverse distances. The output is written in the input format with original coordinates for retained points.
- 适用条件
- The tolerance is measured in the local projected plane, not as a geodesic distance; output distance change is reported separately in WGS84 metres.
- A segment is refused when its longitude span exceeds 180 degrees, any point lies beyond 85 degrees latitude, or its projected bounding-box diagonal exceeds 500 km.
- Only line geometry is accepted; unsupported geometry is rejected rather than discarded.
- Simplification removes points, including their elevation values; retained points keep their original coordinates and elevation.
- The simplified file is a new download. The original file is never modified or overwritten.
- Input files are limited to 20 MB and 200,000 coordinate points; larger files are rejected before simplification.
- Input files are limited to 20 MB and 200,000 coordinate points; larger files are rejected before processing.
- The page starts with a 10 m tolerance, but the value is required and must be between 1 and 100 m.
- 舍入规则
- Tolerance is used as entered (1 to 100 metres); point counts are whole numbers; distances are reported to the nearest whole metre; retained coordinates are not rounded by the tool.
独立算例
期望值由独立算术或已核验算法得出,不由页面脚本生成。
case-track-simplify-offset独立算例
Independent arithmetic: 0.00005 degrees of latitude is about 5.56 m. The middle point deviates from the straight chord by about 5.6 m, which is below the 10 m projected tolerance, so it is removed. Both endpoints remain.
{
"toleranceMeters": 10,
"coordinates": [
[
0,
0
],
[
0.001,
0.00005
],
[
0.002,
0
]
]
}{
"segmentCount": 1,
"originalPointCount": 3,
"simplifiedPointCount": 2
}来源与证据
GPX is an XML schema for exchanging GPS data. GPX 1.1 defines track, route and waypoint structures with latitude, longitude and optional elevation.
GeoJSON defines JSON-based geospatial objects including LineString coordinates. GeoJSON coordinates use longitude, latitude order and positions may include elevation.
The Douglas–Peucker procedure approximates a polyline by retaining points that lie beyond a chosen tolerance from a chord. Endpoints are retained and the approximation is refined iteratively between retained points.
Ramer described an iterative procedure for polygonal approximation of plane curves.
版本与审阅
撰写: RunMap editorial desk (AI-assisted draft and review)
更新于: 2026年10月28日
审阅于: 2026年10月28日 · 1 条审阅记录