PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ST_CurveN()

Datum ST_CurveN ( PG_FUNCTION_ARGS  )

Definition at line 163 of file lwgeom_sqlmm.c.

164 {
165  LWGEOM *subgeom;
166  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
167  GSERIALIZED *ret = NULL;
168  int index = PG_GETARG_INT32(1);
170  if (!lwcmp)
171  PG_RETURN_NULL();
172  if (index < 1 || (uint32_t)index > lwcmp->ngeoms)
173  PG_RETURN_NULL();
174  subgeom = lwgeom_clone(lwcollection_getsubcurve(lwcmp, index-1));
175  ret = geometry_serialize(subgeom);
176  PG_FREE_IF_COPY(geom, 0);
177  PG_RETURN_POINTER(ret);
178 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:268
const LWGEOM * lwcollection_getsubcurve(const LWCOMPOUND *compound, uint32_t gnum)
Definition: lwcompound.c:42
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:491
LWCOMPOUND * lwgeom_as_lwcompound(const LWGEOM *lwgeom)
Definition: lwgeom.c:197
uint32_t ngeoms
Definition: liblwgeom.h:594

References lwcollection_getsubcurve(), lwgeom_as_lwcompound(), lwgeom_clone(), lwgeom_from_gserialized(), and LWCOMPOUND::ngeoms.

Here is the call graph for this function: