examples/example-LambertConformalConic.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::LambertConformalConic class
2 
3 #include <iostream>
4 #include <exception>
6 
7 using namespace std;
8 using namespace GeographicLib;
9 
10 int main() {
11  try {
12  // Define the Pennsylvania South state coordinate system EPSG:3364
13  // http://www.spatialreference.org/ref/epsg/3364/
14  const double
15  a = Constants::WGS84_a(),
16  f = 1/298.257222101, // GRS80
17  lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
18  k1 = 1, // scale
19  lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin
20  fe = 600000, fn = 0; // false easting and northing
21  // Set up basic projection
22  const LambertConformalConic PASouth(a, f, lat1, lat2, k1);
23  double x0, y0;
24  // Transform origin point
25  PASouth.Forward(lon0, lat0, lon0, x0, y0);
26  x0 -= fe; y0 -= fn;
27  {
28  // Sample conversion from geodetic to PASouth grid
29  double lat = 39.95, lon = -75.17; // Philadelphia
30  double x, y;
31  PASouth.Forward(lon0, lat, lon, x, y);
32  x -= x0; y -= y0;
33  cout << x << " " << y << "\n";
34  }
35  {
36  // Sample conversion from PASouth grid to geodetic
37  double x = 820e3, y = 72e3;
38  double lat, lon;
39  x += x0; y += y0;
40  PASouth.Reverse(lon0, x, y, lat, lon);
41  cout << lat << " " << lon << "\n";
42  }
43  }
44  catch (const exception& e) {
45  cerr << "Caught exception: " << e.what() << "\n";
46  return 1;
47  }
48 }
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Scalar * y
static const double lat
Lambert conformal conic projection.
Definition: Half.h:150
Array33i a
Header for GeographicLib::LambertConformalConic class.
const double lat0
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const double lon0
static Symbol x0('x', 0)
static const double lon
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02