PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ centroid()

Datum centroid ( PG_FUNCTION_ARGS  )

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

1523 {
1524  GSERIALIZED *geom, *result;
1525  LWGEOM *lwgeom, *lwresult;
1526 
1527  geom = PG_GETARG_GSERIALIZED_P(0);
1528 
1529  lwgeom = lwgeom_from_gserialized(geom);
1530  lwresult = lwgeom_centroid(lwgeom);
1531  lwgeom_free(lwgeom);
1532  PG_FREE_IF_COPY(geom, 0);
1533 
1534  if (!lwresult) PG_RETURN_NULL();
1535 
1536  result = geometry_serialize(lwresult);
1537  lwgeom_free(lwresult);
1538  PG_RETURN_POINTER(result);
1539 }
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:1138

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: