PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_CleanGeometry()

Datum ST_CleanGeometry ( PG_FUNCTION_ARGS  )

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

139 {
140  GSERIALIZED *in, *out;
141  LWGEOM *lwgeom_in, *lwgeom_out;
142 
143  in = PG_GETARG_GSERIALIZED_P(0);
144  lwgeom_in = lwgeom_from_gserialized(in);
145 
146  /* Short-circuit: empty geometry are the cleanest ! */
147 #if 0
148  if ( lwgeom_is_empty(lwgeom_in) )
149  {
150  out = geometry_serialize(lwgeom_in);
151  PG_FREE_IF_COPY(in, 0);
152  PG_RETURN_POINTER(out);
153  }
154 #endif
155 
156  lwgeom_out = lwgeom_clean(lwgeom_in);
157  if ( ! lwgeom_out )
158  {
159  PG_FREE_IF_COPY(in, 0);
160  PG_RETURN_NULL();
161  }
162 
163  out = geometry_serialize(lwgeom_out);
164  PG_RETURN_POINTER(out);
165 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:203
static LWGEOM * lwgeom_clean(LWGEOM *lwgeom_in)

References lwgeom_clean(), lwgeom_from_gserialized(), and lwgeom_is_empty().

Here is the call graph for this function: