Definition at line 107 of file geometry_inout.c.
References getPoint2d_cp(), gserialized_get_type(), LINETYPE, lwgeom_as_lwline(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_is_empty(), POINTARRAY::npoints, path_to_geometry(), PG_FUNCTION_INFO_V1(), LWLINE::points, pixval::x, POINT2D::x, and POINT2D::y.
Referenced by geometry_to_point().
118 POSTGIS_DEBUG(2,
"geometry_to_path called");
120 if ( PG_ARGISNULL(0) )
123 geom = PG_GETARG_GSERIALIZED_P(0);
126 elog(ERROR,
"geometry_to_path only accepts LineStrings");
134 size = offsetof(PATH, p[0]) +
sizeof(path->p[0]) * pa->
npoints;
135 path = (PATH*)palloc(size);
136 SET_VARSIZE(path, size);
141 for ( i = 0; i < pa->
npoints; i++ )
144 (path->p[i]).
x = pt->
x;
145 (path->p[i]).y = pt->
y;
149 PG_FREE_IF_COPY(geom,0);
151 PG_RETURN_PATH_P(path);
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, int n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...