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

◆ LWGEOM_numpoints_linestring()

Datum LWGEOM_numpoints_linestring ( PG_FUNCTION_ARGS  )

Definition at line 215 of file lwgeom_ogc.c.

216{
217 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
218 LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
219 int count = -1;
220 int type = lwgeom->type;
221
222 if ( type == LINETYPE || type == CIRCSTRINGTYPE || type == COMPOUNDTYPE )
224
225 lwgeom_free(lwgeom);
226 PG_FREE_IF_COPY(geom, 0);
227
228 /* OGC says this functions is only valid on LINESTRING */
229 if ( count < 0 )
230 PG_RETURN_NULL();
231
232 PG_RETURN_INT32(count);
233}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
#define COMPOUNDTYPE
Definition liblwgeom.h:124
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
#define LINETYPE
Definition liblwgeom.h:117
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
Definition lwgeom.c:1229
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
int count
Definition genraster.py:57
uint8_t type
Definition liblwgeom.h:448

References CIRCSTRINGTYPE, COMPOUNDTYPE, LINETYPE, lwgeom_count_vertices(), lwgeom_free(), lwgeom_from_gserialized(), and LWGEOM::type.

Here is the call graph for this function: