stDistance function

FunctionExpression stDistance(
  1. Expression g1,
  2. Expression g2, {
  3. Expression? useSpheroid,
})

For geometry types returns the minimum 2D Cartesian (planar) distance between two geometries, in projected units (spatial ref units).

For geography types defaults to return the minimum geodesic distance between two geographies in meters, compute on the spheroid determined by the SRID. If use_spheroid is false, a faster spherical calculation is used.

Implementation

FunctionExpression stDistance(Expression g1, Expression g2,
        {Expression? useSpheroid}) =>
    FunctionExpression('ST_Distance', [
      g1,
      g2,
      if (useSpheroid != null) useSpheroid,
    ]);