78 bool use_spheroid =
false;
82 g1 = PG_GETARG_GSERIALIZED_P(0);
83 g2 = PG_GETARG_GSERIALIZED_P(1);
100 PG_FREE_IF_COPY(g1, 0);
101 PG_FREE_IF_COPY(g2, 1);
111 POSTGIS_DEBUGF(2,
"[GIST] '%s' got distance %g", __func__, distance);
116 PG_FREE_IF_COPY(g1, 0);
117 PG_FREE_IF_COPY(g2, 1);
120 if ( distance < 0.0 )
125 PG_RETURN_FLOAT8(distance);
void lwgeom_add_bbox_deep(LWGEOM *lwgeom, GBOX *gbox)
Compute a box for geom and all sub-geometries, if not already computed.
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
void error_if_srid_mismatch(int srid1, int srid2)
#define FP_TOLERANCE
Floating point comparators.
Datum distance(PG_FUNCTION_ARGS)
double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, const SPHEROID *spheroid, double tolerance)
Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
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)...