ST_MaxDistance
Name
ST_MaxDistance — Returns the 2D largest distance between two geometries in projected units.
Synopsis
float
ST_MaxDistance
(
geometry
g1
, geometry
g2
)
;
Description
Returns the 2-dimensional maximum distance between two geometries in projected units. If g1 and g2 is the same geometry the function will return the distance between the two vertices most far from each other in that geometry. |
Availability: 1.5.0
Examples
Basic furthest distance the point is to any part of the line
postgis=# SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry); st_maxdistance ----------------- 2 (1 row) postgis=# SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 2, 2 2 )'::geometry); st_maxdistance ------------------ 2.82842712474619 (1 row)