> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_HausdorffDistanceVertices

Returns the vertex-only (discrete) [Hausdorff distance](https://en.wikipedia.org/wiki/Hausdorff_distance) between the given 2 geometries. Both geometries are treated purely as sets of vertices: for every vertex of one geometry the distance to the *nearest vertex* of the other geometry is computed, and the function returns the largest such distance found in either direction.

This differs from [ST\_HausdorffDistance](/reference/wherobots-db/geometry-data/measurement/ST_HausdorffDistance), which measures each vertex against the other geometry's *segments* and can optionally densify those segments. Because segment interiors are ignored here, `ST_HausdorffDistanceVertices` is never smaller than `ST_HausdorffDistance` for the same pair of geometries, and it takes no densityFraction parameter.

If either geometry is empty, `null` is returned.

<Note>
  Even though the function accepts 3D geometry, the z ordinate is ignored and the computed distance is equivalent to the geometries not having the z ordinate.
</Note>

<img src="https://mintcdn.com/wherobots/4T-20ONOb4_nqKpG/images/sql-functions/ST_HausdorffDistanceVertices/ST_HausdorffDistanceVertices.svg?fit=max&auto=format&n=4T-20ONOb4_nqKpG&q=85&s=064a6b2a7271fb83859474d23bf35293" alt="ST_HausdorffDistanceVertices" width="500" height="300" data-path="images/sql-functions/ST_HausdorffDistanceVertices/ST_HausdorffDistanceVertices.svg" />

## Signatures

```sql theme={"system"}
ST_HausdorffDistanceVertices(g1: Geometry, g2: Geometry)
```

## Parameters

<ParamField body="g1" type="Geometry" required>
  The g1 value.
</ParamField>

<ParamField body="g2" type="Geometry" required>
  The g2 value.
</ParamField>

## Return type

<ResponseField type="Double">
  A numeric value.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT ST_HausdorffDistanceVertices(ST_GeomFromWKT('LINESTRING (0 0, 1 1)'), ST_GeomFromWKT('LINESTRING (0 1, 1 0)'))
```

```
1.0
```

The vertices of the second line sit 1 and 2 units above the first line, but their nearest *vertex* is an endpoint of that line, so the result is `sqrt(29)` rather than the segment-based `sqrt(26)`:

```sql theme={"system"}
SELECT ST_HausdorffDistanceVertices(ST_GeomFromWKT('LINESTRING (0 0, 10 0)'), ST_GeomFromWKT('LINESTRING (5 1, 5 2)'))
```

```
5.385164807134504
```
