332 double tolerance = 0.0;
334 bool use_spheroid =
true;
338 g1 = PG_GETARG_GSERIALIZED_P(0);
339 g2 = PG_GETARG_GSERIALIZED_P(1);
344 PG_FREE_IF_COPY(g1, 0);
345 PG_FREE_IF_COPY(g2, 1);
346 PG_RETURN_FLOAT8(0.0);
350 if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
351 tolerance = PG_GETARG_FLOAT8(2);
354 if ( PG_NARGS() > 3 && ! PG_ARGISNULL(3) )
355 use_spheroid = PG_GETARG_BOOL(3);
363 if ( ! use_spheroid )
368 elog(ERROR,
"geography_distance_tree failed!");
372 PG_RETURN_FLOAT8(distance);
void error_if_srid_mismatch(int srid1, int srid2)
int geography_tree_distance(const GSERIALIZED *g1, const GSERIALIZED *g2, const SPHEROID *s, double tolerance, double *distance)
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Datum distance(PG_FUNCTION_ARGS)
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...