PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ spheroid_boundingbox_area()

static double spheroid_boundingbox_area ( const GEOGRAPHIC_POINT southWestCorner,
const GEOGRAPHIC_POINT northEastCorner,
const SPHEROID spheroid 
)
static

Computes the area on the spheroid of a box bounded by meridians and parallels.

The box is defined by two points, the South West corner and the North East corner. Formula based on Bagratuni 1967.

Parameters
southWestCorner- lower left corner of bounding box.
northEastCorner- upper right corner of bounding box.
Returns
area in square meters.

Definition at line 437 of file lwspheroid.c.

References SPHEROID::b, SPHEROID::e_sq, GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, and POW2.

Referenced by spheroid_striparea().

438 {
439  double z0 = (northEastCorner->lon - southWestCorner->lon) * POW2(spheroid->b) / 2.0;
440  double e = sqrt(spheroid->e_sq);
441  double sinPhi1 = sin(southWestCorner->lat);
442  double sinPhi2 = sin(northEastCorner->lat);
443  double t1p1 = sinPhi1 / (1.0 - spheroid->e_sq * sinPhi1 * sinPhi1);
444  double t1p2 = sinPhi2 / (1.0 - spheroid->e_sq * sinPhi2 * sinPhi2);
445  double oneOver2e = 1.0 / (2.0 * e);
446  double t2p1 = oneOver2e * log((1.0 + e * sinPhi1) / (1.0 - e * sinPhi1));
447  double t2p2 = oneOver2e * log((1.0 + e * sinPhi2) / (1.0 - e * sinPhi2));
448  return z0 * (t1p2 + t2p2) - z0 * (t1p1 + t2p1);
449 }
double b
Definition: liblwgeom.h:314
double e_sq
Definition: liblwgeom.h:317
#define POW2(x)
Definition: lwgeodetic.h:47
Here is the caller graph for this function: