Lambert Conformal Conic Projection. More...
#include <GeographicLib/LambertConformalConic.hpp>
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 () |
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 |
Lambert Conformal Conic Projection.
Implementation taken from the report,
This is a straightforward implementation of the equations in Snyder except that Newton's method is used to invert the projection and that several of the formulas are modified so that the projection correctly degenerates to the Mercator projection or the polar sterographic projection.
The ellipsoid parameters, the standard parallels, and the scale on the standard parallels are set in the constructor. If the standard parallels are both at a single pole the projection becomes the polar stereographic projection. If the standard parallels are symmetric around equator, the projection becomes the Mercator projection. 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. The latitude of origin is taken to be the latitude of tangency which lies between the standard parallels which is given by LambertConformalConic::OriginLatitude. 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(), 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; { double gamma, k; // Transform origin point PASouth.Forward(lon0, lat0, lon0, x0, y0, gamma, k); x0 -= fe; y0 -= fn; // Combine result with false origin } double lat, lon, x, y, gamma, k; // Sample conversion from geodetic to PASouth grid std::cin >> lat >> lon; PASouth.Forward(lon0, lat, lon, x, y, gamma, k); 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, gamma, k); std::cout << lat << " " << lon << "\n";
Definition at line 76 of file LambertConformalConic.hpp.
GeographicLib::LambertConformalConic::LambertConformalConic | ( | real | a, | |
real | r, | |||
real | stdlat, | |||
real | k0 | |||
) |
Constructor for a ellipsoid radius a (meters), reciprocal flattening r, standard parallel (the circle of tangency) stdlat (degrees), and scale on the standard parallel k0. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). An exception is thrown if a or k0 is not positive or if stdlat is not in the range [-90, 90].
Definition at line 30 of file LambertConformalConic.cpp.
References GeographicLib::Constants::degree().
GeographicLib::LambertConformalConic::LambertConformalConic | ( | real | a, | |
real | r, | |||
real | stdlat1, | |||
real | stdlat2, | |||
real | k1 | |||
) |
Constructor for a ellipsoid radius a (meters), reciprocal flattening r, standard parallels stdlat1 (degrees) and stdlat2 (degrees), and the scale on the standard parallels k1. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). 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 52 of file LambertConformalConic.cpp.
References GeographicLib::Constants::degree().
GeographicLib::LambertConformalConic::LambertConformalConic | ( | real | a, | |
real | r, | |||
real | sinlat1, | |||
real | coslat1, | |||
real | sinlat2, | |||
real | coslat2, | |||
real | k1 | |||
) |
An alternative constructor for 2 standard parallels where the parallels are given by their sines and cosines. This allows parallels close to the poles to be specified accurately.
Definition at line 81 of file LambertConformalConic.cpp.
void GeographicLib::LambertConformalConic::SetScale | ( | real | lat, | |
real | k = real(1) | |||
) |
Alter the scale for the projection so that on latitude lat, the scale is k (default 1). The allows a "latitude of true scale" to be specified. An exception is thrown if k is not positive.
Definition at line 257 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 () |
Convert from latitude lat (degrees) and longitude lon (degrees) to Lambert conformal conic easting x (meters) and northing y (meters). The central meridian is given by lon0 (degrees) and the latitude origin is given by LambertConformalConic::LatitudeOrigin(). Also return the meridian convergence gamma (degrees) and the scale k. 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. The value of k returned for the poles in infinite (unless lat equals the latitude origin).
Definition at line 149 of file LambertConformalConic.cpp.
References GeographicLib::Constants::degree(), and GeographicLib::Math::expm1().
Referenced by SetScale().
void GeographicLib::LambertConformalConic::Reverse | ( | real | lon0, | |
real | x, | |||
real | y, | |||
real & | lat, | |||
real & | lon, | |||
real & | gamma, | |||
real & | k | |||
) | const throw () |
Convert from Lambert conformal conic easting x (meters) and northing y (meters) to latitude lat (degrees) and longitude lon (degrees) . The central meridian is given by lon0 (degrees) and the latitude origin is given by LambertConformalConic::LatitudeOrigin(). Also return the meridian convergence gamma (degrees) and the scale k. 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).
Definition at line 191 of file LambertConformalConic.cpp.
References GeographicLib::Constants::degree(), GeographicLib::Math::hypot(), and GeographicLib::Math::log1p().
Math::real GeographicLib::LambertConformalConic::MajorRadius | ( | ) | const throw () [inline] |
The major radius of the ellipsoid (meters). This is that value of a used in the constructor.
Definition at line 184 of file LambertConformalConic.hpp.
Math::real GeographicLib::LambertConformalConic::InverseFlattening | ( | ) | const throw () [inline] |
The inverse flattening of the ellipsoid. This is that value of r used in the constructor. A value of 0 is returned for a sphere (infinite inverse flattening).
Definition at line 191 of file LambertConformalConic.hpp.
Math::real GeographicLib::LambertConformalConic::OriginLatitude | ( | ) | const throw () [inline] |
The latitude of the origin for the projection (degrees). This is that 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 199 of file LambertConformalConic.hpp.
Math::real GeographicLib::LambertConformalConic::CentralScale | ( | ) | const throw () [inline] |
The central scale for the projection. This is that scale on the latitude of origin..
Definition at line 205 of file LambertConformalConic.hpp.
A global instantiation of LambertConformalConic with the WGS84 ellipsoid and the UPS scale factor and stdlat = 0. This degenerates to the Mercator projection.
Definition at line 212 of file LambertConformalConic.hpp.