342 double tolerance = 0.0;
344 bool use_spheroid =
true;
348 g1 = PG_GETARG_GSERIALIZED_P(0);
349 g2 = PG_GETARG_GSERIALIZED_P(1);
356 PG_FREE_IF_COPY(g1, 0);
357 PG_FREE_IF_COPY(g2, 1);
358 PG_RETURN_FLOAT8(0.0);
362 if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
363 tolerance = PG_GETARG_FLOAT8(2);
366 if ( PG_NARGS() > 3 && ! PG_ARGISNULL(3) )
367 use_spheroid = PG_GETARG_BOOL(3);
373 if ( ! use_spheroid )
374 s.a =
s.b =
s.radius;
378 elog(ERROR,
"geography_distance_tree failed!");
int geography_tree_distance(const GSERIALIZED *g1, const GSERIALIZED *g2, const SPHEROID *s, double tolerance, double *distance)
void gserialized_error_if_srid_mismatch(const GSERIALIZED *g1, const GSERIALIZED *g2, const char *funcname)
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
static double distance(double x1, double y1, double x2, double y2)