PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwgeom_area()

double lwgeom_area ( const LWGEOM geom)

Definition at line 1862 of file lwgeom.c.

1863 {
1864  int type = geom->type;
1865 
1866  if ( type == POLYGONTYPE )
1867  return lwpoly_area((LWPOLY*)geom);
1868  else if ( type == CURVEPOLYTYPE )
1869  return lwcurvepoly_area((LWCURVEPOLY*)geom);
1870  else if (type == TRIANGLETYPE )
1871  return lwtriangle_area((LWTRIANGLE*)geom);
1872  else if ( lwgeom_is_collection(geom) )
1873  {
1874  double area = 0.0;
1875  uint32_t i;
1876  LWCOLLECTION *col = (LWCOLLECTION*)geom;
1877  for ( i = 0; i < col->ngeoms; i++ )
1878  area += lwgeom_area(col->geoms[i]);
1879  return area;
1880  }
1881  else
1882  return 0.0;
1883 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:125
#define POLYGONTYPE
Definition: liblwgeom.h:118
#define TRIANGLETYPE
Definition: liblwgeom.h:129
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:434
double lwcurvepoly_area(const LWCURVEPOLY *curvepoly)
This should be rewritten to make use of the curve itself.
Definition: lwcurvepoly.c:133
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
double lwgeom_area(const LWGEOM *geom)
Definition: lwgeom.c:1862
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
uint8_t type
Definition: liblwgeom.h:476

References CURVEPOLYTYPE, LWCOLLECTION::geoms, lwcurvepoly_area(), lwgeom_area(), lwgeom_is_collection(), lwpoly_area(), lwtriangle_area(), LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, LWGEOM::type, and ovdump::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: