72{
79 bool use_spheroid = false;
81
82
83 g1 = PG_GETARG_GSERIALIZED_P(0);
84 g2 = PG_GETARG_GSERIALIZED_P(1);
85
87
88
90
91
92 if ( ! use_spheroid )
94
97
98
100 {
101 PG_FREE_IF_COPY(g1, 0);
102 PG_FREE_IF_COPY(g2, 1);
103 PG_RETURN_NULL();
104 }
105
106
109
111
112 POSTGIS_DEBUGF(2,
"[GIST] '%s' got distance %g", __func__,
distance);
113
114
117 PG_FREE_IF_COPY(g1, 0);
118 PG_FREE_IF_COPY(g2, 1);
119
120
122 {
123 PG_RETURN_NULL();
124 }
125
127}
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)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
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.
void lwgeom_free(LWGEOM *geom)
void lwgeom_add_bbox_deep(LWGEOM *lwgeom, GBOX *gbox)
Compute a box for geom and all sub-geometries, if not already computed.
#define FP_TOLERANCE
Floating point comparators.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static double distance(double x1, double y1, double x2, double y2)