PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ centroid()

Datum centroid ( PG_FUNCTION_ARGS  )

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

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

References geometry_serialize(), lwgeom_centroid(), lwgeom_free(), and lwgeom_from_gserialized().

Referenced by getOctant(), getQuadrant4D(), 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(), nextCubeBox3D(), and nextRectBox().

Here is the call graph for this function:
Here is the caller graph for this function: