Definition at line 503 of file geography_measurement.c.
References SPHEROID::a, area(), SPHEROID::b, LWGEOM::bbox, FP_GTEQ, FP_LTEQ, geography_perimeter(), gserialized_get_srid(), LW_FALSE, LW_TRUE, lwgeom_area_sphere(), lwgeom_area_spheroid(), lwgeom_calculate_gbox_geodetic(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_is_empty(), PG_FUNCTION_INFO_V1(), SPHEROID::radius, s, GBOX::zmax, and GBOX::zmin.
Referenced by geography_expand().
513 g = PG_GETARG_GSERIALIZED_P(0);
516 use_spheroid = PG_GETARG_BOOL(1);
527 PG_RETURN_FLOAT8(0.0);
531 gbox = *(lwgeom->
bbox);
543 if ( gbox.
zmax > 0.0 && gbox.
zmin < 0.0 )
549 if ( ! use_spheroid )
560 PG_FREE_IF_COPY(g, 0);
565 elog(ERROR,
"lwgeom_area_spher(oid) returned area < 0.0");
569 PG_RETURN_FLOAT8(area);
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Datum area(PG_FUNCTION_ARGS)
void lwgeom_free(LWGEOM *geom)
#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.
double lwgeom_area_spheroid(const LWGEOM *lwgeom, const SPHEROID *spheroid)
Calculate the geodetic area of a lwgeom on the spheroid.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...