1205 LWGEOM *lwgeoms[2], *outlwg;
1206 uint32 type1, type2;
1210 POSTGIS_DEBUG(2,
"LWGEOM_collect called.");
1213 if (PG_ARGISNULL(0) && PG_ARGISNULL(1))
1217 if (PG_ARGISNULL(0))
1218 PG_RETURN_DATUM(PG_GETARG_DATUM(1));
1221 if (PG_ARGISNULL(1))
1222 PG_RETURN_DATUM(PG_GETARG_DATUM(0));
1224 gser1 = PG_GETARG_GSERIALIZED_P(0);
1225 gser2 = PG_GETARG_GSERIALIZED_P(1);
1229 "LWGEOM_collect(%s, %s): call",
1236 elog(ERROR,
"Cannot ST_Collect geometries with differing dimensionality.");
1245 type1 = lwgeoms[0]->
type;
1246 type2 = lwgeoms[1]->
type;
1253 POSTGIS_DEBUGF(3,
" outtype = %d", outtype);
1262 result = geometry_serialize(outlwg);
1267 PG_FREE_IF_COPY(gser1, 0);
1268 PG_FREE_IF_COPY(gser2, 1);
1270 PG_RETURN_POINTER(
result);
char result[OUT_DOUBLE_BUFFER_SIZE]
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_has_m(const GSERIALIZED *g)
Check if a GSERIALIZED has an M ordinate.
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_has_z(const GSERIALIZED *g)
Check if a GSERIALIZED has a Z ordinate.
uint32_t gserialized_get_type(const GSERIALIZED *g)
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_free(LWGEOM *geom)
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void lwgeom_drop_srid(LWGEOM *lwgeom)