PostGIS  2.5.1dev-r@@SVN_REVISION@@

## ◆ lwgeom_area()

 double lwgeom_area ( const LWGEOM * geom )

Definition at line 1857 of file lwgeom.c.

1858 {
1859  int type = geom->type;
1860
1861  if ( type == POLYGONTYPE )
1862  return lwpoly_area((LWPOLY*)geom);
1863  else if ( type == CURVEPOLYTYPE )
1864  return lwcurvepoly_area((LWCURVEPOLY*)geom);
1865  else if (type == TRIANGLETYPE )
1866  return lwtriangle_area((LWTRIANGLE*)geom);
1867  else if ( lwgeom_is_collection(geom) )
1868  {
1869  double area = 0.0;
1870  uint32_t i;
1871  LWCOLLECTION *col = (LWCOLLECTION*)geom;
1872  for ( i = 0; i < col->ngeoms; i++ )
1873  area += lwgeom_area(col->geoms[i]);
1874  return area;
1875  }
1876  else
1877  return 0.0;
1878 }
#define POLYGONTYPE
Definition: liblwgeom.h:86
Datum area(PG_FUNCTION_ARGS)
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define TRIANGLETYPE
Definition: liblwgeom.h:97
double lwtriangle_area(const LWTRIANGLE *triangle)
Find the area of the outer ring.
Definition: lwtriangle.c:185
uint32_t ngeoms
Definition: liblwgeom.h:509
unsigned int uint32_t
Definition: uthash.h:78
double lwgeom_area(const LWGEOM *geom)
Definition: lwgeom.c:1857
LWGEOM ** geoms
Definition: liblwgeom.h:511
double lwpoly_area(const LWPOLY *poly)
Find the area of the outer ring - sum (area of inner rings).
Definition: lwpoly.c:441
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
uint8_t type
Definition: liblwgeom.h:398
type
Definition: ovdump.py:41
double lwcurvepoly_area(const LWCURVEPOLY *curvepoly)
This should be rewritten to make use of the curve itself.
Definition: lwcurvepoly.c:133
Here is the call graph for this function:
Here is the caller graph for this function: