hausdorffDistance
Computes the discrete Hausdorff distance between geometry a
and geometry b
.
The Hausdorff distance
is a measure of similarity: it is the greatest distance between any point in
a
and the closest point in b
.
The discrete distance is an approximation of this metric: only vertices are
considered. The parameter options.densify
makes this approximation less coarse
by splitting the line segments between vertices before computing the distance.
Parameters
Name | Type | Description |
---|---|---|
a | Geometry | First geometry |
b | Geometry | Second geometry |
options? | object | Optional options object |
options.densify? | number | Optional fraction by which densify each line segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction. Value of 0.25 means that each segment will be split into four equal length subsegments. The closer to 0 the better the approximation of the distance. |
Returns
number
Approximation of Hausdorff distance between geometries
Throws
GEOSError
on unsupported geometry types (curved)GEOSError
when either geometry is emptyGEOSError
whenoptions.densify
is not in the range(0.0, 1.0]