PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ ST_CleanGeometry()

Datum ST_CleanGeometry ( PG_FUNCTION_ARGS  )

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

129 {
130  GSERIALIZED *in, *out;
131  LWGEOM *lwgeom_in, *lwgeom_out;
132 
133  in = PG_GETARG_GSERIALIZED_P(0);
134  lwgeom_in = lwgeom_from_gserialized(in);
135 
136  /* Short-circuit: empty geometry are the cleanest ! */
137 #if 0
138  if ( lwgeom_is_empty(lwgeom_in) )
139  {
140  out = geometry_serialize(lwgeom_in);
141  PG_FREE_IF_COPY(in, 0);
142  PG_RETURN_POINTER(out);
143  }
144 #endif
145 
146  lwgeom_out = lwgeom_clean(lwgeom_in);
147  if ( ! lwgeom_out )
148  {
149  PG_FREE_IF_COPY(in, 0);
150  PG_RETURN_NULL();
151  }
152 
153  out = geometry_serialize(lwgeom_out);
154  PG_RETURN_POINTER(out);
155 }
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: