PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ centroid()

Datum centroid ( PG_FUNCTION_ARGS  )

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

1458 {
1459  GSERIALIZED *geom, *result;
1460  LWGEOM *lwgeom, *lwresult;
1461 
1462  geom = PG_GETARG_GSERIALIZED_P(0);
1463 
1464  lwgeom = lwgeom_from_gserialized(geom);
1465  lwresult = lwgeom_centroid(lwgeom);
1466  lwgeom_free(lwgeom);
1467  PG_FREE_IF_COPY(geom, 0);
1468 
1469  if (!lwresult) PG_RETURN_NULL();
1470 
1471  result = geometry_serialize(lwresult);
1472  lwgeom_free(lwresult);
1473  PG_RETURN_POINTER(result);
1474 }
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: