211 bool use_spheroid =
true;
215 g1 = PG_GETARG_GSERIALIZED_P(0);
216 g2 = PG_GETARG_GSERIALIZED_P(1);
219 use_spheroid = PG_GETARG_BOOL(2);
227 if ( ! use_spheroid )
228 s.a =
s.b =
s.radius;
233 PG_FREE_IF_COPY(g1, 0);
234 PG_FREE_IF_COPY(g2, 1);
254 PG_FREE_IF_COPY(g1, 0);
255 PG_FREE_IF_COPY(g2, 1);
263 elog(ERROR,
"distance returned negative!");
int geography_tree_distance(const GSERIALIZED *g1, const GSERIALIZED *g2, const SPHEROID *s, double tolerance, double *distance)
int geography_distance_cache(FunctionCallInfo fcinfo, const GSERIALIZED *g1, const GSERIALIZED *g2, const SPHEROID *s, 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.
#define FP_TOLERANCE
Floating point comparators.
static double distance(double x1, double y1, double x2, double y2)