511 g = PG_GETARG_GSERIALIZED_P(0);
514 use_spheroid = PG_GETARG_BOOL(1);
525 PG_RETURN_FLOAT8(0.0);
529 gbox = *(lwgeom->
bbox);
533 #ifndef PROJ_GEODESIC
541 if ( gbox.
zmax > 0.0 && gbox.
zmin < 0.0 )
547 if ( ! use_spheroid )
548 s.a =
s.b =
s.radius;
558 PG_FREE_IF_COPY(g, 0);
563 elog(ERROR,
"lwgeom_area_spher(oid) returned area < 0.0");
567 PG_RETURN_FLOAT8(area);
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
double lwgeom_area_spheroid(const LWGEOM *lwgeom, const SPHEROID *spheroid)
Calculate the geodetic area of a lwgeom on the spheroid.
#define LW_TRUE
Return types for functions with status returns.
double lwgeom_area_sphere(const LWGEOM *lwgeom, const SPHEROID *spheroid)
Calculate the geodetic area of a lwgeom on the sphere.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)