PostGIS  2.5.7dev-r@@SVN_REVISION@@

## ◆ lwgeom_area()

 double lwgeom_area ( const LWGEOM * geom )

Definition at line 1872 of file lwgeom.c.

1873 {
1874  int type = geom->type;
1875
1876  if ( type == POLYGONTYPE )
1877  return lwpoly_area((LWPOLY*)geom);
1878  else if ( type == CURVEPOLYTYPE )
1879  return lwcurvepoly_area((LWCURVEPOLY*)geom);
1880  else if (type == TRIANGLETYPE )
1881  return lwtriangle_area((LWTRIANGLE*)geom);
1882  else if ( lwgeom_is_collection(geom) )
1883  {
1884  double area = 0.0;
1885  uint32_t i;
1886  LWCOLLECTION *col = (LWCOLLECTION*)geom;
1887  for ( i = 0; i < col->ngeoms; i++ )
1888  area += lwgeom_area(col->geoms[i]);
1889  return area;
1890  }
1891  else
1892  return 0.0;
1893 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:98
double lwtriangle_area(const LWTRIANGLE *triangle)
Find the area of the outer ring.
Definition: lwtriangle.c:185
double lwpoly_area(const LWPOLY *poly)
Find the area of the outer ring - sum (area of inner rings).
Definition: lwpoly.c:441
double lwcurvepoly_area(const LWCURVEPOLY *curvepoly)
This should be rewritten to make use of the curve itself.
Definition: lwcurvepoly.c:134
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
double lwgeom_area(const LWGEOM *geom)
Definition: lwgeom.c:1872
Datum area(PG_FUNCTION_ARGS)
type
Definition: ovdump.py:41
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78
Here is the call graph for this function:
Here is the caller graph for this function: