Douglas-Peucker Tree Example

Points visited: 0 (0%)
Segments visited: 0 (0%)

Use-Case

A tool to fit arbitrary geo-coordinates (GPS) with errors performantly onto a predefined path for live geo-tracking.

Usage

The mouse cursor is the GPS source, with an accuracy roughly the size of the circle. The green dot follows the mouse on the path starting at the red dot, without jumping at intersections or close segments.

It will only move "forward" in segments, but can move backward within the coordinates inside the current segment (assuming the tracked person will only move forward along the route).

Yellow lines show the subdivision path segments that are used for finding the closest point.

Algorithm

This algorithm subdivides a path of (geo)coordinates via Duglas-Peucker into a simplified version, building a tree of the simplifications. It then iteratively finds the closest point on those subsections to finally find the closest point on the original path.

This improves the performance of finding the closest point, especially for paths with a high number of close coordinates. It improves accuracy and performance over a QuadTree approach for cases where the path intersects itself or creates "holes".

Also, the algorithm uses a forward-only search with a cut-off at a specific amount of distance along the path (that could be calculated from avg travel speed), to further optimize for the use-case of following geo-tracking coordinates that should trace a specific path/route.