Public Member Functions | Static Public Attributes

GeographicLib::LambertConformalConic Class Reference

Lambert Conformal Conic Projection. More...

#include <GeographicLib/LambertConformalConic.hpp>

List of all members.

Public Member Functions

 LambertConformalConic (real a, real r, real stdlat, real k0)
 LambertConformalConic (real a, real r, real stdlat1, real stdlat2, real k1)
 LambertConformalConic (real a, real r, 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 InverseFlattening () const throw ()
Math::real OriginLatitude () const throw ()
Math::real CentralScale () const throw ()

Static Public Attributes

static const LambertConformalConic Mercator

Detailed Description

Lambert Conformal Conic Projection.

Implementation taken from the report,

This is a implementation of the equations in Snyder except that divided differences have been used to transform the expressions into ones which may be evaluated accurately and that Newton's method is used to invert the projection. In this implementation, the projection correctly becomes the Mercator projection or the polar sterographic projection when the standard latitude is the equator or a pole. The accuracy of the projections is about 10 nm.

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 tangency (also the latitude of minimum scale), with a scale specified on this parallel. This latitude is also used as the latitude of origin which is returned by LambertConformalConic::OriginLatitude. The scale on the latitude of origin is given by LambertConformalConic::CentralScale. The case with two distinct standard parallels where one is a pole is singular and is disallowed. The central meridian (which is a trivial shift of the longitude) is specified as the lon0 argument of the LambertConformalConic::Forward and LambertConformalConic::Reverse functions. There is no provision in this class for specifying a false easting or false northing or a different latitude of origin. However these are can be simply included by the calling function. For example the Pennsylvania South state coordinate system (EPSG:3364) is obtained by:

   const double
     a = GeographicLib::Constants::WGS84_a<double>(),
     r = 298.257222101,                        // GRS80
     lat1 = 39 + 56/60.0, lat1 = 40 + 58/60.0, // standard parallels
     k1 = 1,                                   // scale
     lat0 = 39 + 20/60.0, lon0 = 75 + 45/60.0, // origin
     fe = 600000, fn = 0;                      // false easting and northing
   // Set up basic projection
   const GeographicLib::LambertConformalConic PASouth(a, r, lat1, lat2, k1);
   double x0, y0;
   {
     // Transform origin point
     PASouth.Forward(lon0, lat0, lon0, x0, y0);
     x0 -= fe; y0 -= fn;         // Combine result with false origin
   }
   double lat, lon, x, y;
   // Sample conversion from geodetic to PASouth grid
   std::cin >> lat >> lon;
   PASouth.Forward(lon0, lat, lon, x, y);
   x -= x0; y -= y0;
   std::cout << x << " " << y << "\n";
   // Sample conversion from PASouth grid to geodetic
   std::cin >> x >> y;
   x += x0; y += y0;
   PASouth.Reverse(lon0, x, y, lat, lon);
   std::cout << lat << " " << lon << "\n";

Definition at line 81 of file LambertConformalConic.hpp.


Constructor & Destructor Documentation

GeographicLib::LambertConformalConic::LambertConformalConic ( real  a,
real  r,
real  stdlat,
real  k0 
)

Constructor with a single standard parallel.

Parameters:
[in] a equatorial radius of ellipsoid (meters)
[in] r reciprocal flattening of ellipsoid. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). Negative r indicates a prolate ellipsoid.
[in] stdlat standard parallel (degrees), the circle of tangency.
[in] k0 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 28 of file LambertConformalConic.cpp.

GeographicLib::LambertConformalConic::LambertConformalConic ( real  a,
real  r,
real  stdlat1,
real  stdlat2,
real  k1 
)

Constructor with two standard parallels.

Parameters:
[in] a equatorial radius of ellipsoid (meters)
[in] r reciprocal flattening of ellipsoid. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). Negative r indicates a prolate ellipsoid.
[in] stdlat1 first standard parallel (degrees).
[in] stdlat2 second standard parallel (degrees).
[in] k1 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, if either stdlat1 or stdlat2 is a pole, then an exception is thrown if stdlat1 is not equal stdlat2.

Definition at line 53 of file LambertConformalConic.cpp.

GeographicLib::LambertConformalConic::LambertConformalConic ( real  a,
real  r,
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] r reciprocal flattening of ellipsoid. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). Negative r indicates 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 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 scale at this latitude. In the case where lat1 and lat2 are different, the errors in this routines are as follows: if dlat = abs(lat2 - lat1) <= 160o and max(abs(lat1), abs(lat2)) <= 90 - min(0.0002, 2.2e-6(180 - dlat), 6e-8dlat2) (in degrees), then the error in the latitude of origin is less than 4.5e-14o and the relative error in the scale is less than 7e-15.

Definition at line 81 of file LambertConformalConic.cpp.


Member Function Documentation

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

Set the scale for the projection.

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

This allows a "latitude of true scale" to be specified. An exception is thrown if k is not positive or if stdlat is not in the range [-90, 90]

Definition at line 453 of file LambertConformalConic.cpp.

References Forward().

void GeographicLib::LambertConformalConic::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] 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 scale of projection at point.

The latitude origin is given by LambertConformalConic::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 error in the projection is less than about 10 nm (true distance) and the errors in the meridian convergence and scale are consistent with this. 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 324 of file LambertConformalConic.cpp.

References GeographicLib::Math::asinh().

Referenced by Forward(), and SetScale().

void GeographicLib::LambertConformalConic::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] 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 scale of projection at point.

The latitude origin is given by LambertConformalConic::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 error in the projection is less than about 10 nm (true distance) and the errors in the meridian convergence and scale are consistent with this.

Definition at line 370 of file LambertConformalConic.cpp.

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

Referenced by Reverse().

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

LambertConformalConic::Forward without returning the convergence and scale.

Definition at line 281 of file LambertConformalConic.hpp.

References Forward().

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

LambertConformalConic::Reverse without returning the convergence and scale.

Definition at line 291 of file LambertConformalConic.hpp.

References Reverse().

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

Definition at line 304 of file LambertConformalConic.hpp.

Math::real GeographicLib::LambertConformalConic::InverseFlattening (  )  const throw () [inline]
Returns:
r the inverse flattening of the ellipsoid. This is the value used in the constructor. A value of 0 is returned for a sphere (infinite inverse flattening).

Definition at line 311 of file LambertConformalConic.hpp.

Math::real GeographicLib::LambertConformalConic::OriginLatitude (  )  const throw () [inline]
Returns:
latitude of the origin for the projection (degrees).

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

Definition at line 320 of file LambertConformalConic.hpp.

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

Definition at line 326 of file LambertConformalConic.hpp.


Member Data Documentation

A global instantiation of LambertConformalConic with the WGS84 ellipsoid, stdlat = 0, and k0 = 1. This degenerates to the Mercator projection.

Definition at line 334 of file LambertConformalConic.hpp.


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