1215 LWGEOM **lwgeoms, *outlwg;
1221 ArrayIterator iterator;
1225 POSTGIS_DEBUG(2,
"LWGEOM_collect_garray called.");
1227 if ( PG_ARGISNULL(0) )
1231 array = PG_GETARG_ARRAYTYPE_P(0);
1232 nelems = ArrayGetNItems(ARR_NDIM(array), ARR_DIMS(array));
1234 POSTGIS_DEBUGF(3,
" array is %d-bytes in size, %ld w/out header",
1235 ARR_SIZE(array), ARR_SIZE(array)-ARR_OVERHEAD_NONULLS(ARR_NDIM(array)));
1237 POSTGIS_DEBUGF(3,
"LWGEOM_collect_garray: array has %d elements", nelems);
1247 lwgeoms = palloc(
sizeof(
LWGEOM*) * nelems);
1251 #if POSTGIS_PGSQL_VERSION >= 95
1252 iterator = array_create_iterator(array, 0, NULL);
1254 iterator = array_create_iterator(array, 0);
1257 while( array_iterate(iterator, &
value, &isnull) )
1271 POSTGIS_DEBUGF(3,
"%s: geom %d deserialized", __func__,
count);
1279 if ( lwgeoms[
count]->bbox )
1292 if ( lwgeoms[
count]->bbox )
1322 array_free_iterator(iterator);
1325 POSTGIS_DEBUGF(3,
"LWGEOM_collect_garray: outtype = %d", outtype);
1336 box,
count, lwgeoms);
1340 PG_RETURN_POINTER(result);
int gbox_merge(const GBOX *new_box, GBOX *merge_box)
Update the merged GBOX to be large enough to include itself and the new box.
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
uint32_t lwtype_get_collectiontype(uint8_t type)
Given an lwtype number, what homogeneous collection can hold it?
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void error_if_srid_mismatch(int srid1, int srid2)
#define SRID_UNKNOWN
Unknown SRID value.
void lwgeom_drop_srid(LWGEOM *lwgeom)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)