810 char b1mem[GIDX_MAX_SIZE];
811 GIDX *b1 = (GIDX*)b1mem;
812 char b2mem[GIDX_MAX_SIZE];
813 GIDX *b2 = (GIDX*)b2mem;
815 #if POSTGIS_PGSQL_VERSION < 95
818 Datum gs1 = PG_GETARG_DATUM(0);
819 Datum gs2 = PG_GETARG_DATUM(1);
820 double box_distance = FLT_MAX;
823 if ( (gserialized_datum_get_gidx_p(gs1, b1) ==
LW_SUCCESS) &&
824 (gserialized_datum_get_gidx_p(gs2, b2) ==
LW_SUCCESS) )
826 box_distance = gidx_distance_leaf_centroid(b1, b2);
827 POSTGIS_DEBUGF(3,
"got boxes %s and %s", gidx_to_string(b1), gidx_to_string(b2));
829 PG_RETURN_FLOAT8(box_distance);
860 double m1 = 0, m2 = 0;
900 gserialized_get_gidx_p(geom1, b1);
901 gserialized_get_gidx_p(geom2, b2);
913 PG_FREE_IF_COPY(geom1, 0);
914 PG_FREE_IF_COPY(geom2, 1);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
static double gidx_distance_m(const GIDX *a, const GIDX *b)
int lwpoint_getPoint4d_p(const LWPOINT *point, POINT4D *out)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
void lwpoint_free(LWPOINT *pt)
void lwgeom_free(LWGEOM *geom)
double lwgeom_interpolate_point(const LWGEOM *lwin, const LWPOINT *lwpt)
Find the measure value at the location on the line closest to the point.
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
double lwgeom_length(const LWGEOM *geom)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWGEOM * lwgeom_closest_line(const LWGEOM *lw1, const LWGEOM *lw2)
double lwgeom_length_2d(const LWGEOM *geom)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
LWGEOM * lwgeom_closest_line_3d(const LWGEOM *lw1, const LWGEOM *lw2)
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Datum distance(PG_FUNCTION_ARGS)