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 )
550 s.a =
s.b =
s.radius;
560 PG_FREE_IF_COPY(g, 0);
565 elog(ERROR,
"lwgeom_area_spher(oid) returned area < 0.0");
569 PG_RETURN_FLOAT8(
area);
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)...
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.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
#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.
Datum area(PG_FUNCTION_ARGS)