945 GEOSGeometry *g, *g_centroid;
971 g_centroid = GEOSGetCentroid(g);
974 if (g_centroid == NULL)
980 LWDEBUGF(3,
"result: %s", GEOSGeomToWKT(g_centroid));
982 GEOSSetSRID(g_centroid, srid);
985 GEOSGeom_destroy(g_centroid);
987 if (centroid == NULL)
989 lwerror(
"GEOS GEOSGetCentroid() threw an error (result postgis geometry formation)!");
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
Datum centroid(PG_FUNCTION_ARGS)
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
#define LWDEBUGF(level, msg,...)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
void lwerror(const char *fmt,...)
Write a notice out to the error handler.