Top

Name

st_distance — Returns the shortest distance between two points.

Synopsis

st_distance ( in g1 any ,
  in g2 any );
 

Description

Returns the shortest distance between two points such that the first point is part of g1 and the second of g2. The srid of g1 and g2 must be the same. If the srid is 4326, the haversine function is used to compute a great circle distance in kilometers on Earth. Otherwise the distance is calculated as on a flat Euclidean plane.

Parameters

g1

Geometry.

g2

Geometry.

Return Types

Returns double precision.

Examples

Example 24.139. Simple Use

SQL>SELECT st_distance (st_point(0, 52),st_point(0, 70));
callret
VARCHAR
_____________________________
 2000.388915449352
No. of rows in result: 1