PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_GeneratePoints()

Datum ST_GeneratePoints ( PG_FUNCTION_ARGS  )

Definition at line 1028 of file postgis/lwgeom_geos.c.

1029 {
1030  GSERIALIZED *gser_input;
1031  GSERIALIZED *gser_result;
1032  LWGEOM *lwgeom_input;
1033  LWGEOM *lwgeom_result;
1034  int32 npoints;
1035 
1036  gser_input = PG_GETARG_GSERIALIZED_P(0);
1037  npoints = DatumGetInt32(DirectFunctionCall1(numeric_int4, PG_GETARG_DATUM(1)));
1038 
1039  if (npoints < 0)
1040  PG_RETURN_NULL();
1041 
1042  /* Types get checked in the code, we'll keep things small out there */
1043  lwgeom_input = lwgeom_from_gserialized(gser_input);
1044  lwgeom_result = (LWGEOM*)lwgeom_to_points(lwgeom_input, npoints);
1045  lwgeom_free(lwgeom_input);
1046  PG_FREE_IF_COPY(gser_input, 0);
1047 
1048  /* Return null as null */
1049  if (!lwgeom_result)
1050  PG_RETURN_NULL();
1051 
1052  /* Serialize and return */
1053  gser_result = gserialized_from_lwgeom(lwgeom_result, 0);
1054  lwgeom_free(lwgeom_result);
1055  PG_RETURN_POINTER(gser_result);
1056 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWMPOINT * lwgeom_to_points(const LWGEOM *lwgeom, uint32_t npoints)
unsigned int int32
Definition: shpopen.c:273

References gserialized_from_lwgeom(), lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_to_points().

Here is the call graph for this function: