PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ centroid()

Datum centroid ( PG_FUNCTION_ARGS  )

Definition at line 1271 of file postgis/lwgeom_geos.c.

References dumpnode::geom, geometry_serialize(), lwgeom_centroid(), lwgeom_free(), lwgeom_from_gserialized(), PG_FUNCTION_INFO_V1(), and ST_ClipByBox2d().

Referenced by gserialized_spgist_choose_2d(), gserialized_spgist_choose_3d(), gserialized_spgist_inner_consistent_2d(), gserialized_spgist_inner_consistent_3d(), gserialized_spgist_picksplit_2d(), gserialized_spgist_picksplit_3d(), lwgeom_cluster_2d_kmeans(), and pointonsurface().

1272 {
1273  GSERIALIZED *geom, *result;
1274  LWGEOM *lwgeom, *lwresult;
1275 
1276  geom = PG_GETARG_GSERIALIZED_P(0);
1277 
1278  lwgeom = lwgeom_from_gserialized(geom);
1279  lwresult = lwgeom_centroid(lwgeom);
1280  lwgeom_free(lwgeom);
1281  PG_FREE_IF_COPY(geom, 0);
1282 
1283  if (!lwresult) PG_RETURN_NULL();
1284 
1285  result = geometry_serialize(lwresult);
1286  lwgeom_free(lwresult);
1287  PG_RETURN_POINTER(result);
1288 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_centroid(const LWGEOM *geom)
LWGEOM * geom
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: