GeographicLib  1.21
Public Member Functions | Static Public Attributes
GeographicLib::AlbersEqualArea Class Reference

Albers Equal Area Conic Projection. More...

#include <GeographicLib/AlbersEqualArea.hpp>

List of all members.

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 throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const throw ()
void Forward (real lon0, real lat, real lon, real &x, real &y) const throw ()
void Reverse (real lon0, real x, real y, real &lat, real &lon) const throw ()
Inspector functions
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real OriginLatitude () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const AlbersEqualArea CylindricalEqualArea
static const AlbersEqualArea AzimuthalEqualAreaNorth
static const AlbersEqualArea AzimuthalEqualAreaSouth

Detailed Description

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, gamma, 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 gamma 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:

// Example of using the GeographicLib::AlbersEqualArea class
// $Id: 230027b09ff2dfa7940202913a6d965281818b99 $

#include <iostream>
#include <exception>
#include <GeographicLib/AlbersEqualArea.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
   const double
     a = Constants::WGS84_a<double>(),
     f = Constants::WGS84_f<double>(),
     lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
     k1 = 1,                                   // scale
     lon0 = -77 - 45/60.0;                     // Central meridan
   // Set up basic projection
   const AlbersEqualArea albers(a, f, lat1, lat2, k1);
   {
     // Sample conversion from geodetic to Albers Equal Area
     double lat = 39.95, lon = -75.17;    // Philadelphia
     double x, y;
     albers.Forward(lon0, lat, lon, x, y);
     std::cout << x << " " << y << "\n";
   }
   {
     // Sample conversion from Albers Equal Area grid to geodetic
     double x = 220e3, y = -53e3;
     double lat, lon;
     albers.Reverse(lon0, x, y, lat, lon);
     std::cout << lat << " " << lon << "\n";
   }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

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


Constructor & Destructor Documentation

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

Constructor with a single standard parallel.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]stdlatstandard parallel (degrees), the circle of tangency.
[in]k0azimuthal scale on the standard parallel.

An exception is thrown if a or k0 is not positive or if stdlat is not in the range [-90, 90].

Definition at line 31 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite().

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

Constructor with two standard parallels.

Parameters:
[in]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]stdlat1first standard parallel (degrees).
[in]stdlat2second standard parallel (degrees).
[in]k1azimuthal scale on the standard parallels.

An exception is thrown if a or k0 is not positive or if stdlat1 or stdlat2 is not in the range [-90, 90]. In addition, an exception is thrown if stdlat1 and stdlat2 are opposite poles.

Definition at line 56 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite().

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]aequatorial radius of ellipsoid (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f.
[in]sinlat1sine of first standard parallel.
[in]coslat1cosine of first standard parallel.
[in]sinlat2sine of second standard parallel.
[in]coslat2cosine of second standard parallel.
[in]k1azimuthal scale on the standard parallels.

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(lat2 - lat1) <= 160o, then the error in the latitude of origin is less than 4.5e-14o.

Definition at line 84 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite().


Member Function Documentation

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

Set the azimuthal scale for the projection.

Parameters:
[in]lat(degrees).
[in]kazimuthal scale at latitude lat (default 1).

This allows a "latitude of conformality" to be specified. An exception is thrown if k is not positive or if lat is not in the range (-90, 90).

Definition at line 439 of file AlbersEqualArea.cpp.

References GeographicLib::Math::isfinite(), Forward(), and GeographicLib::Math::sq().

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

Forward projection, from geographic to Lambert conformal conic.

Parameters:
[in]lon0central meridian longitude (degrees).
[in]latlatitude of point (degrees).
[in]lonlongitude of point (degrees).
[out]xeasting of point (meters).
[out]ynorthing of point (meters).
[out]gammameridian convergence at point (degrees).
[out]kazimuthal 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]; lon and lon0 should be in the range [-180, 360]. 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 379 of file AlbersEqualArea.cpp.

References GeographicLib::Math::sq().

Referenced by SetScale().

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

Reverse projection, from Lambert conformal conic to geographic.

Parameters:
[in]lon0central meridian longitude (degrees).
[in]xeasting of point (meters).
[in]ynorthing of point (meters).
[out]latlatitude of point (degrees).
[out]lonlongitude of point (degrees).
[out]gammameridian convergence at point (degrees).
[out]kazimuthal 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. lon0 should be in the range [-180, 360]. 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 409 of file AlbersEqualArea.cpp.

References GeographicLib::Math::hypot(), and GeographicLib::Math::sq().

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

AlbersEqualArea::Forward without returning the convergence and scale.

Definition at line 233 of file AlbersEqualArea.hpp.

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

AlbersEqualArea::Reverse without returning the convergence and scale.

Definition at line 243 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 256 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 262 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::OriginLatitude ( ) const throw () [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 279 of file AlbersEqualArea.hpp.

Math::real GeographicLib::AlbersEqualArea::CentralScale ( ) const throw () [inline]
Returns:
central scale for the projection. This is the azimuthal scale on the latitude of origin.

Definition at line 285 of file AlbersEqualArea.hpp.


Member Data Documentation

A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, stdlat = 0, and k0 = 1. This degenerates to the cylindrical equal area projection.

Definition at line 293 of file AlbersEqualArea.hpp.

A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, stdlat = 90o, and k0 = 1. This degenerates to the Lambert azimuthal equal area projection.

Definition at line 300 of file AlbersEqualArea.hpp.

A global instantiation of AlbersEqualArea with the WGS84 ellipsoid, stdlat = -90o, and k0 = 1. This degenerates to the Lambert azimuthal equal area projection.

Definition at line 307 of file AlbersEqualArea.hpp.


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