ST_HausdorffDistance()

Computes the discrete Hausdorff distance between two geometries.

Syntax

ST_HausdorffDistance(geom1, geom2)

Arguments

Argument

Description

geom1

First GEOMETRY or GEOMETRY32 value.

geom2

Second value from the same geometry family.

Return Value

Returns FLOAT64 for GEOMETRY inputs and FLOAT32 for GEOMETRY32 inputs.

Usage Notes

The calculation is planar and follows the order of the input vertices. Source evidence: test/distributed/cases/geo/geo_discrete.sql.

Examples

DROP DATABASE IF EXISTS geo_operation_demo;
CREATE DATABASE geo_operation_demo;
USE geo_operation_demo;

SELECT ST_HausdorffDistance(ST_GeomFromText('LINESTRING(0 0,10 0)'), ST_GeomFromText('LINESTRING(0 1,10 1)')) AS distance_value;

DROP DATABASE geo_operation_demo;

See Also

Geo Functions Overview