geoprimsField-grade geospatial math

Compare two tracks

How far apart two GPS tracks or routes are: the discrete Fréchet distance (the leash two walkers need, with where it is tightest), the Hausdorff distance, and their closest approach.

14.007m

The tracks are 14.007 m apart by Fréchet distance, tightest at points 4 and 4, and 14.007 m by Hausdorff distance.

Tightest at first-track point
and second-track point
Hausdorff distance
Closest approach
Provenance
Computed by
geometry.distance.tracks 1.0.0, core 0.1.0
Model
Discrete Fréchet by the Eiter-Mannila recurrence over geodesic point distances (Karney's inverse), with the tightest pair found by walking the best coupling back; Hausdorff as the larger of the two directed maxima of each point's geodesic distance to the other track's segments; closest approach as the least point-to-segment distance, or 0 where segments cross on an azimuthal equidistant plane
Accuracy
Distances exact to the geodesic (under 1 µm); Fréchet is the discrete measure over the given points, so sample both tracks alike
Notes
None
Cites
Eiter, T., and Mannila, H., Technische Universität Wien, Computing Discrete Fréchet Distance

Something look off?

Your values

Showing an example. Change anything.
KML, KMZ, GPX, GeoJSON, CSV, WKT, or WKB — or drop it on the box. Read on this device.
KML, KMZ, GPX, GeoJSON, CSV, WKT, or WKB — or drop it on the box. Read on this device.
How we got thisFormula, worked example, sources, and proof

Model: Discrete Fréchet by the Eiter-Mannila recurrence over geodesic point distances (Karney's inverse), with the tightest pair found by walking the best coupling back; Hausdorff as the larger of the two directed maxima of each point's geodesic distance to the other track's segments; closest approach as the least point-to-segment distance, or 0 where segments cross on an azimuthal equidistant plane

Accuracy: Distances exact to the geodesic (under 1 µm); Fréchet is the discrete measure over the given points, so sample both tracks alike

When to use this: Use this to ask how alike two paths are: a flown track against the route that was filed, a survey line against the one that was planned, two GPS traces of the same journey, a vehicle's path against a corridor. Three numbers come back because they answer different questions. The Fréchet distance is the leash two walkers need if neither may go backwards, so it notices when two paths cover the same ground in a different order or at a different pace. The Hausdorff distance ignores order and asks only how far any point of one is from the other path. The closest approach is how near they ever come, which is zero if they cross.

Limitations: The Fréchet distance here is the discrete one, taken over the points as given, so it depends on how the two tracks are sampled: a coarse track compared against a fine one will show a Fréchet distance of about the coarse track's own step, which is a fact about the sampling and not about the paths. Sample both alike, or densify first. The Hausdorff distance says nothing about direction or order — two tracks over the same ground in opposite directions have a Hausdorff distance of zero and a Fréchet distance of the whole track length, which is correct and is the clearest illustration of what each measure is for. Neither is a similarity score: they are worst-case distances, so one stray point moves them both.

Worked example: A planned line and the flown track. Source: checked against GEOS 3.11.4 through shapely on PROJ's azimuthal equidistant plane — GEOS's own Fréchet implementation, and its point-to-segment distance for the Hausdorff — over fourteen pairs of tracks, agreeing to 6.3e-9 relative at worst.

You enter

First track
40, -105 40.001, -104.999 40.002, -104.998 40.003, -104.997
Second track
40, -104.9999 40.00105, -104.9989 40.0021, -104.998 40.0029, -104.9971

You get

Fréchet distance
14.007 m
Tightest at first-track point
4
and second-track point
4
Hausdorff distance
14.007 m
Closest approach
0 m

Review: Not yet independently reviewed by a GIS professional.

Last verified: 2026-09-22, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Checked against: 20 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources