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

◆ ST_CleanGeometry()

Datum ST_CleanGeometry ( PG_FUNCTION_ARGS  )

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

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

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

Here is the call graph for this function: