31 #include "../postgis_config.h"
36 #include "lwgeom_pg.h"
46 LWGEOM *lwgeom_in, *lwgeom_out;
48 in = PG_GETARG_GSERIALIZED_P_COPY(0);
51 POSTGIS_DEBUG(1,
"ST_MakeValid enter");
53 switch ( lwgeom_in->
type )
65 lwpgerror(
"ST_MakeValid: unsupported geometry type %s",
74 PG_FREE_IF_COPY(in, 0);
78 out = geometry_serialize(lwgeom_out);
80 PG_RETURN_POINTER(out);
99 lwpgnotice(
"lwgeom_clean: dimensional collapse (%d to %d)",
109 lwpgnotice(
"lwgeom_clean: mixed-type output (%s) "
110 "from single-type input (%s)",
131 LWGEOM *lwgeom_in, *lwgeom_out;
133 in = PG_GETARG_GSERIALIZED_P(0);
140 out = geometry_serialize(lwgeom_in);
141 PG_FREE_IF_COPY(in, 0);
142 PG_RETURN_POINTER(out);
149 PG_FREE_IF_COPY(in, 0);
153 out = geometry_serialize(lwgeom_out);
154 PG_RETURN_POINTER(out);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
int lwgeom_dimensionality(const LWGEOM *geom)
Return the dimensionality (relating to point/line/poly) of an lwgeom.
LWGEOM * lwgeom_make_valid(LWGEOM *geom)
Attempts to make an invalid geometries valid w/out losing points.
This library is the generic geometry handling section of PostGIS.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static LWGEOM * lwgeom_clean(LWGEOM *lwgeom_in)
Datum ST_CleanGeometry(PG_FUNCTION_ARGS)
Datum ST_MakeValid(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(ST_MakeValid)