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

◆ lwgeom_clean()

static LWGEOM * lwgeom_clean ( LWGEOM lwgeom_in)
static

Definition at line 96 of file postgis/lwgeom_geos_clean.c.

97{
98 LWGEOM* lwgeom_out;
99
100 lwgeom_out = lwgeom_make_valid(lwgeom_in);
101 if ( ! lwgeom_out )
102 {
103 return NULL;
104 }
105
106 /* Check dimensionality is the same as input */
107 if ( lwgeom_dimensionality(lwgeom_in) != lwgeom_dimensionality(lwgeom_out) )
108 {
109 lwpgnotice("lwgeom_clean: dimensional collapse (%d to %d)",
110 lwgeom_dimensionality(lwgeom_in), lwgeom_dimensionality(lwgeom_out));
111
112 return NULL;
113 }
114
115 /* Check that the output is not a collection if the input wasn't */
116 if ( lwgeom_out->type == COLLECTIONTYPE &&
117 lwgeom_in->type != COLLECTIONTYPE )
118 {
119 lwpgnotice("lwgeom_clean: mixed-type output (%s) "
120 "from single-type input (%s)",
121 lwtype_name(lwgeom_out->type),
122 lwtype_name(lwgeom_in->type));
123 return NULL;
124 }
125
126 /* Force right-hand-rule (will only affect polygons) */
127 /* gout := ST_ForceRHR(gout); */
128
129 /* Remove repeated duplicated points ? */
130 /* gout = ST_RemoveRepeatedPoints(gout); */
131
132 return lwgeom_out;
133}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define COLLECTIONTYPE
Definition liblwgeom.h:108
int lwgeom_dimensionality(const LWGEOM *geom)
Return the dimensionality (relating to point/line/poly) of an lwgeom.
Definition lwgeom.c:1517
LWGEOM * lwgeom_make_valid(LWGEOM *geom)
Attempts to make an invalid geometries valid w/out losing points.
uint8_t type
Definition liblwgeom.h:462

References COLLECTIONTYPE, lwgeom_dimensionality(), lwgeom_make_valid(), lwtype_name(), and LWGEOM::type.

Referenced by ST_CleanGeometry().

Here is the call graph for this function:
Here is the caller graph for this function: