PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 310 of file lwspheroid.c.

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

Referenced by spheroid_striparea().

311 {
312  double z0 = (northEastCorner->lon - southWestCorner->lon) * POW2(spheroid->b) / 2.0;
313  double e = sqrt(spheroid->e_sq);
314  double sinPhi1 = sin(southWestCorner->lat);
315  double sinPhi2 = sin(northEastCorner->lat);
316  double t1p1 = sinPhi1 / (1.0 - spheroid->e_sq * sinPhi1 * sinPhi1);
317  double t1p2 = sinPhi2 / (1.0 - spheroid->e_sq * sinPhi2 * sinPhi2);
318  double oneOver2e = 1.0 / (2.0 * e);
319  double t2p1 = oneOver2e * log((1.0 + e * sinPhi1) / (1.0 - e * sinPhi1));
320  double t2p2 = oneOver2e * log((1.0 + e * sinPhi2) / (1.0 - e * sinPhi2));
321  return z0 * (t1p2 + t2p2) - z0 * (t1p1 + t2p1);
322 }
double b
Definition: liblwgeom.h:270
double e_sq
Definition: liblwgeom.h:273
#define POW2(x)
Definition: lwgeodetic.h:28

Here is the caller graph for this function: