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 }
GeographicLib::LambertConformalConic::Reverse
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
Definition: src/LambertConformalConic.cpp:373
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
fn
static double fn[10]
Definition: fresnl.c:103
x
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
Definition: gnuplot_common_settings.hh:12
y0
double y0(double x)
Definition: j0.c:220
LambertConformalConic.hpp
Header for GeographicLib::LambertConformalConic class.
main
int main()
Definition: examples/example-LambertConformalConic.cpp:10
example::lat0
const double lat0
Definition: testGPSFactor.cpp:41
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
k1
double k1(double x)
Definition: k1.c:133
x0
static Symbol x0('x', 0)
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
GeographicLib::LambertConformalConic::Forward
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Definition: src/LambertConformalConic.cpp:331
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
GeographicLib::LambertConformalConic
Lambert conformal conic projection.
Definition: LambertConformalConic.hpp:63
std
Definition: BFloat16.h:88
lon
static const double lon
Definition: testGeographicLib.cpp:34
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:16