57 bool use_spheroid =
true;
62 g = PG_GETARG_GSERIALIZED_P(0);
79 PG_RETURN_POINTER(g_out);
83 spheroid_init_from_srid(fcinfo, srid, &
s);
86 use_spheroid = PG_GETARG_BOOL(1);
111 for (i = 0; i < size; i++) {
162 elog(ERROR,
"ST_Centroid(geography) unhandled geography type");
166 PG_FREE_IF_COPY(g, 0);
172 PG_RETURN_POINTER(g_out);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
LWPOINT * geography_centroid_from_mpoly(const LWMPOLY *mpoly, bool use_spheroid, SPHEROID *s)
Split polygons into triangles and use centroid of the triangle with the triangle area as weight to ca...
LWPOINT * geography_centroid_from_mline(const LWMLINE *mline, SPHEROID *s)
Split lines into segments and calculate with middle of segment as weighted point.
LWPOINT * geography_centroid_from_wpoints(const uint32_t srid, const POINT3DM *points, const uint32_t size)
Convert lat-lon-points to x-y-z-coordinates, calculate a weighted average point and return lat-lon-co...
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
LWMPOLY * lwmpoly_construct_empty(int srid, char hasz, char hasm)
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
void lwmpoly_free(LWMPOLY *mpoly)
LWMLINE * lwmline_construct_empty(int srid, char hasz, char hasm)
double lwpoint_get_x(const LWPOINT *point)
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWMLINE * lwgeom_as_lwmline(const LWGEOM *lwgeom)
LWMPOLY * lwmpoly_add_lwpoly(LWMPOLY *mobj, const LWPOLY *obj)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
void lwmline_free(LWMLINE *mline)
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
double lwpoint_get_y(const LWPOINT *point)