PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwgeom_clean()

static LWGEOM * lwgeom_clean ( LWGEOM lwgeom_in)
static

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

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

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: