PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ ST_GeneratePoints()

Datum ST_GeneratePoints ( PG_FUNCTION_ARGS  )

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

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

Referenced by buffer().

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