PostGIS  2.2.8dev-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 423 of file lwspheroid.c.

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

Referenced by spheroid_striparea().

424 {
425  double z0 = (northEastCorner->lon - southWestCorner->lon) * POW2(spheroid->b) / 2.0;
426  double e = sqrt(spheroid->e_sq);
427  double sinPhi1 = sin(southWestCorner->lat);
428  double sinPhi2 = sin(northEastCorner->lat);
429  double t1p1 = sinPhi1 / (1.0 - spheroid->e_sq * sinPhi1 * sinPhi1);
430  double t1p2 = sinPhi2 / (1.0 - spheroid->e_sq * sinPhi2 * sinPhi2);
431  double oneOver2e = 1.0 / (2.0 * e);
432  double t2p1 = oneOver2e * log((1.0 + e * sinPhi1) / (1.0 - e * sinPhi1));
433  double t2p2 = oneOver2e * log((1.0 + e * sinPhi2) / (1.0 - e * sinPhi2));
434  return z0 * (t1p2 + t2p2) - z0 * (t1p1 + t2p1);
435 }
double b
Definition: liblwgeom.h:298
double e_sq
Definition: liblwgeom.h:301
#define POW2(x)
Definition: lwgeodetic.h:27
Here is the caller graph for this function: