Skip to content
On this page

geos.GEOSHausdorffDistance ⇒ number

Computes the Hausdorff distance between two geometries. The Hausdorff distance is a measure of how similar or dissimilar two geometries are. It is the greatest distance between any point in one geometry and the closest point in the other geometry. The smaller the Hausdorff distance, the more similar the geometries are.

Kind: Exported member
Returns: number - 1 on success, 0 on exception.

ParamTypeDescription
g1numberInput geometry pointer.
g2numberInput geometry pointer.
distnumberPointer to be filled in with distance result.

geos.GEOSHausdorffDistanceDensify ⇒ number

Computes an approximation to the Hausdorff distance between two geometries by densifying them before computing their discrete Hausdorff distance. The densification fraction parameter controls how much densification occurs. A fraction of 0.0 results in no densification, while a fraction of 1.0 results in effectively computing the exact Hausdorff distance. The fraction is relative to the size of the input geometries: a fraction of 1.0 means that each input segment will be divided into a number of equal-length segments such that the minimum segment length in either input is equal to that length. Increasing values of fraction reduce performance but increase accuracy of the calculated distance. A reasonable fraction value is 0.25 (which corresponds to segmenting each input segment into quarters).

Kind: Exported member
Returns: number - 1 on success, 0 on exception.

ParamTypeDescription
g1numberInput geometry pointer.
g2numberInput geometry pointer.
densifyFracnumberA fraction between 0 and 1 denoting the degree to which edges should be subdivided (smaller value means more subdivisions).
distnumberPointer to be filled in with distance result.

geos.GEOSHausdorffDistanceDensify_r ⇒ number

Computes the Hausdorff distance between two geometries, densifying them by a given fraction. The Hausdorff distance is a measure of how similar or dissimilar two geometries are. It is the greatest distance between any point in one geometry and the closest point in the other geometry. Densifying the geometries involves inserting extra vertices along every line segment so that the total length of the segments is increased by a given fraction.

Kind: Exported member
Returns: number - 1 on success, 0 on exception.
See

ParamTypeDescription
handlenumberA pointer to the GEOS context handle.
g1numberThe first geometry.
g2numberThe second geometry.
densifyFracnumberThe fraction by which to densify each segment. Must be between 0 and 1.
distancenumberA pointer to a double to store the computed distance.

geos.GEOSHausdorffDistance_r ⇒ number

Computes the Hausdorff distance between two geometries. The Hausdorff distance is a measure of how similar or dissimilar two geometries are. It is the greatest distance between any point in one geometry and the closest point in the other geometry. The smaller the Hausdorff distance, the more similar the geometries are. This is a thread-safe version of GEOSHausdorffDistance.

Kind: Exported member
Returns: number - 1 on success, 0 on exception.

ParamTypeDescription
handlenumberThe context handle.pointer
g1numberInput geometry pointer.
g2numberInput geometry pointer.
distnumberPointer to be filled in with distance result.