PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ centroid()

Datum centroid ( PG_FUNCTION_ARGS  )

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

1431 {
1432  GSERIALIZED *geom, *result;
1433  LWGEOM *lwgeom, *lwresult;
1434 
1435  geom = PG_GETARG_GSERIALIZED_P(0);
1436 
1437  lwgeom = lwgeom_from_gserialized(geom);
1438  lwresult = lwgeom_centroid(lwgeom);
1439  lwgeom_free(lwgeom);
1440  PG_FREE_IF_COPY(geom, 0);
1441 
1442  if (!lwresult) PG_RETURN_NULL();
1443 
1444  result = geometry_serialize(lwresult);
1445  lwgeom_free(lwresult);
1446  PG_RETURN_POINTER(result);
1447 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
LWGEOM * lwgeom_centroid(const LWGEOM *geom)
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155

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

Referenced by getOctant(), getQuadrant4D(), gserialized_spgist_choose_2d(), gserialized_spgist_choose_3d(), gserialized_spgist_choose_nd(), gserialized_spgist_inner_consistent_2d(), gserialized_spgist_inner_consistent_3d(), gserialized_spgist_inner_consistent_nd(), gserialized_spgist_picksplit_2d(), gserialized_spgist_picksplit_3d(), gserialized_spgist_picksplit_nd(), lwgeom_cluster_kmeans(), nextCubeBox(), nextCubeBox3D(), and nextRectBox().

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