Skip to content

ST_Distance

Returns the distance between two geometries or geographies.

Usage

double ST_Distance(geomA: geometry, geomB: geometry)

Arguments

  • geomA (geometry): Input geometry
  • geomB (geometry): Input geometry

Description

Returns the 2D Cartesian (planar) distance between two geometries, in the units of the coordinate reference system. For geographic distance calculations, use ST_DistanceSphere or ST_DistanceSpheroid.

Examples

SELECT ST_Distance(ST_Point(0, 0), ST_Point(1, 1));
┌──────────────────────────────────────────────────────────────────────┐
│ st_distance(st_point(Int64(0),Int64(0)),st_point(Int64(1),Int64(1))) │
│                                float64                               │
╞══════════════════════════════════════════════════════════════════════╡
│                                                   1.4142135623730951 │
└──────────────────────────────────────────────────────────────────────┘