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

◆ path_to_geometry()

Datum path_to_geometry ( PG_FUNCTION_ARGS  )

Definition at line 145 of file geometry_inout.c.

146{
147 PATH *path;
148 LWLINE *lwline;
149 POINTARRAY *pa;
150 GSERIALIZED *geom;
151 POINT4D pt;
152 Point p;
153 int i;
154
155 POSTGIS_DEBUG(2, "path_to_geometry called");
156
157 if ( PG_ARGISNULL(0) )
158 PG_RETURN_NULL();
159
160 path = PG_GETARG_PATH_P(0);
161
162 if ( ! path )
163 PG_RETURN_NULL();
164
165 pa = ptarray_construct_empty(0, 0, path->npts);
166 for ( i = 0; i < path->npts; i++ )
167 {
168 p = path->p[i];
169 pt.x = p.x;
170 pt.y = p.y;
172 }
173 lwline = lwline_construct(SRID_UNKNOWN, NULL, pa);
174 geom = geometry_serialize(lwline_as_lwgeom(lwline));
175 lwline_free(lwline);
176
177 PG_RETURN_POINTER(geom);
178}
#define LW_FALSE
Definition liblwgeom.h:94
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition lwline.c:42
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition lwgeom.c:367
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition ptarray.c:147
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:215
void lwline_free(LWLINE *line)
Definition lwline.c:67
double x
Definition liblwgeom.h:414
double y
Definition liblwgeom.h:414

References LW_FALSE, lwline_as_lwgeom(), lwline_construct(), lwline_free(), ptarray_append_point(), ptarray_construct_empty(), SRID_UNKNOWN, POINT4D::x, struct_point::x, POINT4D::y, and struct_point::y.

Here is the call graph for this function: