PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_geometryn_collection()

Datum LWGEOM_geometryn_collection ( PG_FUNCTION_ARGS  )

Definition at line 373 of file lwgeom_ogc.c.

374{
375 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
376 LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
377 GSERIALIZED *result = NULL;
378 int32 idx = PG_GETARG_INT32(1);
379 LWGEOM *subgeom = NULL;
380
381 /* TIN and PolyhedralSurface are treated as unitary geometries */
382 subgeom = lwgeom_extract_geometry_n(lwgeom, idx, false);
383
384 if (!subgeom)
385 PG_RETURN_NULL();
386
387 /* If not returning the original geometry */
388 if (subgeom != lwgeom)
389 {
390 subgeom->srid = lwgeom->srid;
391 /* COMPUTE_BBOX==TAINTING */
392 if (lwgeom->bbox) lwgeom_add_bbox(subgeom);
393 }
394 result = geometry_serialize(subgeom);
395 PG_FREE_IF_COPY(geom, 0);
396 PG_RETURN_POINTER(result);
397}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition lwgeom.c:723
static LWGEOM * lwgeom_extract_geometry_n(LWGEOM *lwgeom, int32 idx, bool patches_as_geometries)
Definition lwgeom_ogc.c:320
unsigned int int32
Definition shpopen.c:54
GBOX * bbox
Definition liblwgeom.h:458
int32_t srid
Definition liblwgeom.h:460

References LWGEOM::bbox, lwgeom_add_bbox(), lwgeom_extract_geometry_n(), lwgeom_from_gserialized(), result, and LWGEOM::srid.

Here is the call graph for this function: