GeographicLib: GeographicLib::AlbersEqualArea Class Reference (original) (raw)

Albers equal area conic projection. More...

#include <[GeographicLib/AlbersEqualArea.hpp](AlbersEqualArea%5F8hpp%5Fsource.html)>

Public Member Functions
AlbersEqualArea (real a, real f, real stdlat, real k0)
AlbersEqualArea (real a, real f, real stdlat1, real stdlat2, real k1)
AlbersEqualArea (real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1)
void SetScale (real lat, real k=real(1))
void Forward (real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
void Forward (real lon0, real lat, real lon, real &x, real &y) const
void Reverse (real lon0, real x, real y, real &lat, real &lon) const
Inspector functions
Math::real EquatorialRadius () const
Math::real Flattening () const
Math::real OriginLatitude () const
Math::real CentralScale () const
Static Public Member Functions
static const AlbersEqualArea & CylindricalEqualArea ()
static const AlbersEqualArea & AzimuthalEqualAreaNorth ()
static const AlbersEqualArea & AzimuthalEqualAreaSouth ()

Albers equal area conic projection.

Implementation taken from the report,

This is a implementation of the equations in Snyder except that divided differences will be [have been] used to transform the expressions into ones which may be evaluated accurately. [In this implementation, the projection correctly becomes the cylindrical equal area or the azimuthal equal area projection when the standard latitude is the equator or a pole.]

The ellipsoid parameters, the standard parallels, and the scale on the standard parallels are set in the constructor. Internally, the case with two standard parallels is converted into a single standard parallel, the latitude of minimum azimuthal scale, with an azimuthal scale specified on this parallel. This latitude is also used as the latitude of origin which is returned by AlbersEqualArea::OriginLatitude. The azimuthal scale on the latitude of origin is given by AlbersEqualArea::CentralScale. The case with two standard parallels at opposite poles is singular and is disallowed. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions. AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the meridian convergence, γ, and azimuthal scale, k. A small square aligned with the cardinal directions is projected to a rectangle with dimensions k (in the E-W direction) and 1/k (in the N-S direction). The E-W sides of the rectangle are oriented γ degrees counter-clockwise from the x axis. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin.

Example of use:

#include

#include

using namespace std;

try {

const double

a = Constants::WGS84_a(),

f = Constants::WGS84_f(),

lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0,

k1 = 1,

lon0 = -77 - 45/60.0;

{

double lat = 39.95, lon = -75.17;

double x, y;

albers.Forward(lon0, lat, lon, x, y);

cout << x << " " << y << "\n";

}

{

double x = 220e3, y = -53e3;

double lat, lon;

albers.Reverse(lon0, x, y, lat, lon);

cout << lat << " " << lon << "\n";

}

}

catch (const exception& e) {

cerr << "Caught exception: " << e.what() << "\n";

return 1;

}

}

Header for GeographicLib::AlbersEqualArea class.

int main(int argc, const char *const argv[])

Albers equal area conic projection.

Namespace for GeographicLib.

ConicProj is a command-line utility providing access to the functionality of LambertConformalConic and AlbersEqualArea.

Definition at line 60 of file AlbersEqualArea.hpp.

GeographicLib::AlbersEqualArea::AlbersEqualArea ( real a,
real f,
real stdlat,
real k0 )

Constructor with a single standard parallel.

Parameters

[in] a equatorial radius of ellipsoid (meters).
[in] f flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in] stdlat standard parallel (degrees), the circle of tangency.
[in] k0 azimuthal scale on the standard parallel.

Exceptions

Definition at line 16 of file AlbersEqualArea.cpp.

References GeographicLib::Math::qd, and GeographicLib::Math::sincosd().

AlbersEqualArea() [2/3]

GeographicLib::AlbersEqualArea::AlbersEqualArea ( real a,
real f,
real stdlat1,
real stdlat2,
real k1 )

Constructor with two standard parallels.

Parameters

[in] a equatorial radius of ellipsoid (meters).
[in] f flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in] stdlat1 first standard parallel (degrees).
[in] stdlat2 second standard parallel (degrees).
[in] k1 azimuthal scale on the standard parallels.

Exceptions

GeographicErr if a, (1 − f) a, or k1 is not positive.
GeographicErr if stdlat1 or stdlat2 is not in [−90°, 90°], or if stdlat1 and stdlat2 are opposite poles.

Definition at line 45 of file AlbersEqualArea.cpp.

References GeographicLib::Math::qd, and GeographicLib::Math::sincosd().

AlbersEqualArea() [3/3]

GeographicLib::AlbersEqualArea::AlbersEqualArea ( real a,
real f,
real sinlat1,
real coslat1,
real sinlat2,
real coslat2,
real k1 )

Constructor with two standard parallels specified by sines and cosines.

Parameters

[in] a equatorial radius of ellipsoid (meters).
[in] f flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in] sinlat1 sine of first standard parallel.
[in] coslat1 cosine of first standard parallel.
[in] sinlat2 sine of second standard parallel.
[in] coslat2 cosine of second standard parallel.
[in] k1 azimuthal scale on the standard parallels.

Exceptions

GeographicErr if a, (1 − f) a, or k1 is not positive.
GeographicErr if stdlat1 or stdlat2 is not in [−90°, 90°], or if stdlat1 and stdlat2 are opposite poles.

This allows parallels close to the poles to be specified accurately. This routine computes the latitude of origin and the azimuthal scale at this latitude. If dlat = abs(lat2lat1) ≤ 160°, then the error in the latitude of origin is less than 4.5 × 10−14d;.

Definition at line 81 of file AlbersEqualArea.cpp.

References GeographicLib::Math::qd.

SetScale()

void GeographicLib::AlbersEqualArea::SetScale ( real lat,
real k = real(1) )

Forward() [1/2]

void GeographicLib::AlbersEqualArea::Forward ( real lon0,
real lat,
real lon,
real & x,
real & y,
real & gamma,
real & k ) const

Forward projection, from geographic to Lambert conformal conic.

Parameters

[in] lon0 central meridian longitude (degrees).
[in] lat latitude of point (degrees).
[in] lon longitude of point (degrees).
[out] x easting of point (meters).
[out] y northing of point (meters).
[out] gamma meridian convergence at point (degrees).
[out] k azimuthal scale of projection at point; the radial scale is the 1/k.

The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No false easting or northing is added and lat should be in the range [−90°, 90°]. The values of x and y returned for points which project to infinity (i.e., one or both of the poles) will be large but finite.

Definition at line 496 of file AlbersEqualArea.cpp.

References GeographicLib::Math::AngDiff(), GeographicLib::Math::degree(), GeographicLib::Math::LatFix(), GeographicLib::Math::sincosd(), and GeographicLib::Math::sq().

Referenced by main(), and SetScale().

Reverse() [1/2]

void GeographicLib::AlbersEqualArea::Reverse ( real lon0,
real x,
real y,
real & lat,
real & lon,
real & gamma,
real & k ) const

Reverse projection, from Lambert conformal conic to geographic.

Parameters

[in] lon0 central meridian longitude (degrees).
[in] x easting of point (meters).
[in] y northing of point (meters).
[out] lat latitude of point (degrees).
[out] lon longitude of point (degrees).
[out] gamma meridian convergence at point (degrees).
[out] k azimuthal scale of projection at point; the radial scale is the 1/k.

The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No false easting or northing is added. The value of lon returned is in the range [−180°, 180°]. The value of lat returned is in the range [−90°, 90°]. If the input point is outside the legal projected space the nearest pole is returned.

Definition at line 521 of file AlbersEqualArea.cpp.

References GeographicLib::Math::AngNormalize(), GeographicLib::Math::atand(), GeographicLib::Math::degree(), and GeographicLib::Math::sq().

Referenced by main().

Forward() [2/2]

void GeographicLib::AlbersEqualArea::Forward ( real lon0, real lat, real lon, real & x, real & y ) const inline

Reverse() [2/2]

void GeographicLib::AlbersEqualArea::Reverse ( real lon0, real x, real y, real & lat, real & lon ) const inline

EquatorialRadius()

Math::real GeographicLib::AlbersEqualArea::EquatorialRadius ( ) const inline

Returns

a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 265 of file AlbersEqualArea.hpp.

Flattening()

Math::real GeographicLib::AlbersEqualArea::Flattening ( ) const inline

Returns

f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 271 of file AlbersEqualArea.hpp.

OriginLatitude()

Math::real GeographicLib::AlbersEqualArea::OriginLatitude ( ) const inline

Returns

latitude of the origin for the projection (degrees).

This is the latitude of minimum azimuthal scale and equals the stdlat in the 1-parallel constructor and lies between stdlat1 and stdlat2 in the 2-parallel constructors.

Definition at line 280 of file AlbersEqualArea.hpp.

CentralScale()

Math::real GeographicLib::AlbersEqualArea::CentralScale ( ) const inline

Returns

central scale for the projection. This is the azimuthal scale on the latitude of origin.

Definition at line 286 of file AlbersEqualArea.hpp.

CylindricalEqualArea()

const AlbersEqualArea & GeographicLib::AlbersEqualArea::CylindricalEqualArea ( ) static

AzimuthalEqualAreaNorth()

const AlbersEqualArea & GeographicLib::AlbersEqualArea::AzimuthalEqualAreaNorth ( ) static

AzimuthalEqualAreaSouth()

const AlbersEqualArea & GeographicLib::AlbersEqualArea::AzimuthalEqualAreaSouth ( ) static

The documentation for this class was generated from the following files: