PostGIS  2.2.8dev-r@@SVN_REVISION@@

## ◆ lwgeom_area()

 double lwgeom_area ( const LWGEOM * geom )

Definition at line 1579 of file lwgeom.c.

Referenced by LWGEOM_area_polygon(), and test_misc_area().

1580 {
1581  int type = geom->type;
1582
1583  if ( type == POLYGONTYPE )
1584  return lwpoly_area((LWPOLY*)geom);
1585  else if ( type == CURVEPOLYTYPE )
1586  return lwcurvepoly_area((LWCURVEPOLY*)geom);
1587  else if (type == TRIANGLETYPE )
1588  return lwtriangle_area((LWTRIANGLE*)geom);
1589  else if ( lwgeom_is_collection(geom) )
1590  {
1591  double area = 0.0;
1592  int i;
1593  LWCOLLECTION *col = (LWCOLLECTION*)geom;
1594  for ( i = 0; i < col->ngeoms; i++ )
1595  area += lwgeom_area(col->geoms[i]);
1596  return area;
1597  }
1598  else
1599  return 0.0;
1600 }
#define POLYGONTYPE
Definition: liblwgeom.h:72
Datum area(PG_FUNCTION_ARGS)
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define TRIANGLETYPE
Definition: liblwgeom.h:83
double lwtriangle_area(const LWTRIANGLE *triangle)
Find the area of the outer ring.
Definition: lwtriangle.c:173
double lwgeom_area(const LWGEOM *geom)
Definition: lwgeom.c:1579
LWGEOM ** geoms
Definition: liblwgeom.h:493
double lwpoly_area(const LWPOLY *poly)
Find the area of the outer ring - sum (area of inner rings).
Definition: lwpoly.c:411
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:991
uint8_t type
Definition: liblwgeom.h:380
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:120
Here is the call graph for this function:
Here is the caller graph for this function: