PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_area()

double lwgeom_area ( const LWGEOM geom)

Definition at line 1999 of file lwgeom.c.

2000{
2001 int type = geom->type;
2002
2003 if ( type == POLYGONTYPE )
2004 return lwpoly_area((LWPOLY*)geom);
2005 else if ( type == CURVEPOLYTYPE )
2006 return lwcurvepoly_area((LWCURVEPOLY*)geom);
2007 else if (type == TRIANGLETYPE )
2008 return lwtriangle_area((LWTRIANGLE*)geom);
2009 else if ( lwgeom_is_collection(geom) )
2010 {
2011 double area = 0.0;
2012 uint32_t i;
2013 LWCOLLECTION *col = (LWCOLLECTION*)geom;
2014 for ( i = 0; i < col->ngeoms; i++ )
2015 area += lwgeom_area(col->geoms[i]);
2016 return area;
2017 }
2018 else
2019 return 0.0;
2020}
#define CURVEPOLYTYPE
Definition liblwgeom.h:111
#define POLYGONTYPE
Definition liblwgeom.h:104
#define TRIANGLETYPE
Definition liblwgeom.h:115
double lwtriangle_area(const LWTRIANGLE *triangle)
Find the area of the outer ring.
Definition lwtriangle.c:178
double lwpoly_area(const LWPOLY *poly)
Find the area of the outer ring - sum (area of inner rings).
Definition lwpoly.c:433
double lwcurvepoly_area(const LWCURVEPOLY *curvepoly)
This should be rewritten to make use of the curve itself.
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1125
double lwgeom_area(const LWGEOM *geom)
Definition lwgeom.c:1999
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

References CURVEPOLYTYPE, LWCOLLECTION::geoms, lwcurvepoly_area(), lwgeom_area(), lwgeom_is_collection(), lwpoly_area(), lwtriangle_area(), LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwgeom_area(), lwmpoly_to_points(), ST_Area(), test_gdal_polygonize(), test_lwpoly_construct_circle(), test_misc_area(), and test_raster_surface().

Here is the call graph for this function:
Here is the caller graph for this function: