PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ centroid()

Datum centroid ( PG_FUNCTION_ARGS  )

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

1548 {
1549  GSERIALIZED *geom, *result;
1550  LWGEOM *lwgeom, *lwresult;
1551 
1552  geom = PG_GETARG_GSERIALIZED_P(0);
1553 
1554  lwgeom = lwgeom_from_gserialized(geom);
1555  lwresult = lwgeom_centroid(lwgeom);
1556  lwgeom_free(lwgeom);
1557  PG_FREE_IF_COPY(geom, 0);
1558 
1559  if (!lwresult) PG_RETURN_NULL();
1560 
1561  result = geometry_serialize(lwresult);
1562  lwgeom_free(lwresult);
1563  PG_RETURN_POINTER(result);
1564 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
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: