Name

ST_Distance — Returns the 2-dimensional cartesian minimum distance between two geometries in projected units.

Synopsis

float ST_Distance(geometry g1, geometry g2);

Description

Returns the 2-dimensional minimum cartesian distance between two geometries in projected units.

This method implements the OpenGIS Simple Features Implementation Specification for SQL.

This method implements the SQL/MM specification: SQL-MM 3: 5.1.23

Examples

postgis=# SELECT ST_Distance('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry);
   st_distance
-----------------
 1.4142135623731
(1 row)

See Also

ST_DWithin, ST_Distance_Sphere, ST_Distance_Spheroid, ST_Max_Distance