131{
132 GEOSGeometry *g1, *gn, *gm;
135 int pn, ln, np, nl;
136
138 lwerror(
"Noding geometries of dimension != 1 is unsupported");
139 return NULL;
140 }
141
144 if ( ! g1 ) {
146 return NULL;
147 }
148
150 if ( ! ep ) {
151 GEOSGeom_destroy(g1);
152 lwerror(
"Error extracting unique endpoints from input");
153 return NULL;
154 }
155
156 gn = GEOSNode(g1);
157 GEOSGeom_destroy(g1);
158 if ( ! gn ) {
161 return NULL;
162 }
163
164 gm = GEOSLineMerge(gn);
165 GEOSGeom_destroy(gn);
166 if ( ! gm ) {
169 return NULL;
170 }
171
173 GEOSGeom_destroy(gm);
174 if ( ! lines ) {
176 lwerror(
"Error during GEOS2LWGEOM");
177 return NULL;
178 }
179
180
181
182
183
184
185
186
187
188
192
194 for (pn=0; pn<np; ++pn) {
195
197
199 for (ln=0; ln<nl; ++ln) {
200
202
204
206
208
209 break;
210 }
211
212
213
214
218 while (nl > ln+1) {
220 --nl;
221 }
226 } else {
228
233 }
234
235
238
239 break;
240 }
241
242 }
243
246
249}
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
void lwgeom_set_srid(LWGEOM *geom, int32_t srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
void lwgeom_free(LWGEOM *geom)
#define FLAGS_GET_Z(flags)
int lwgeom_dimension(const LWGEOM *geom)
For an LWGEOM, returns 0 for points, 1 for lines, 2 for polygons, 3 for volume, and the max dimension...
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
#define FLAGS_GET_M(flags)
void lwcollection_free(LWCOLLECTION *col)
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
LWCOLLECTION * lwcollection_clone_deep(const LWCOLLECTION *lwgeom)
Deep clone LWCOLLECTION object.
int lwline_split_by_point_to(const LWLINE *ln, const LWPOINT *pt, LWMLINE *to)
Split a line by a point and push components to the provided multiline.
void lwcollection_reserve(LWCOLLECTION *col, uint32_t ngeoms)
Ensure the collection can hold at least up to ngeoms geometries.
static LWGEOM * lwgeom_extract_unique_endpoints(const LWGEOM *lwg)
static const LWGEOM * lwgeom_subgeom(const LWGEOM *g, int n)
static int lwgeom_ngeoms(const LWGEOM *n)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.