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);
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
void lwmline_free(LWMLINE *mline)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
LWMPOLY * lwmpoly_construct_empty(int srid, char hasz, char hasm)
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)
LWMLINE * lwmline_construct_empty(int srid, char hasz, char hasm)
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
double lwpoint_get_x(const LWPOINT *point)
void lwmpoly_free(LWMPOLY *mpoly)
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...
LWMLINE * lwgeom_as_lwmline(const LWGEOM *lwgeom)
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWPOINT * geography_centroid_from_mline(const LWMLINE *mline, SPHEROID *s)
Split lines into segments and calculate with middle of segment as weighted point. ...
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
double lwpoint_get_y(const LWPOINT *point)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
LWMPOLY * lwmpoly_add_lwpoly(LWMPOLY *mobj, const LWPOLY *obj)
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...
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)