examples/example-AlbersEqualArea.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::AlbersEqualArea class
2 
3 #include <iostream>
4 #include <exception>
6 
7 using namespace std;
8 using namespace GeographicLib;
9 
10 int main() {
11  try {
12  const double
13  a = Constants::WGS84_a(),
14  f = Constants::WGS84_f(),
15  lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
16  k1 = 1, // scale
17  lon0 = -77 - 45/60.0; // Central meridian
18  // Set up basic projection
19  const AlbersEqualArea albers(a, f, lat1, lat2, k1);
20  {
21  // Sample conversion from geodetic to Albers Equal Area
22  double lat = 39.95, lon = -75.17; // Philadelphia
23  double x, y;
24  albers.Forward(lon0, lat, lon, x, y);
25  cout << x << " " << y << "\n";
26  }
27  {
28  // Sample conversion from Albers Equal Area grid to geodetic
29  double x = 220e3, y = -53e3;
30  double lat, lon;
31  albers.Reverse(lon0, x, y, lat, lon);
32  cout << lat << " " << lon << "\n";
33  }
34  }
35  catch (const exception& e) {
36  cerr << "Caught exception: " << e.what() << "\n";
37  return 1;
38  }
39 }
GeographicLib::AlbersEqualArea
Albers equal area conic projection.
Definition: AlbersEqualArea.hpp:60
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
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
main
int main()
Definition: examples/example-AlbersEqualArea.cpp:10
GeographicLib::AlbersEqualArea::Reverse
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
Definition: src/AlbersEqualArea.cpp:411
AlbersEqualArea.hpp
Header for GeographicLib::AlbersEqualArea class.
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
k1
double k1(double x)
Definition: k1.c:133
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
std
Definition: BFloat16.h:88
GeographicLib::AlbersEqualArea::Forward
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Definition: src/AlbersEqualArea.cpp:386
lon
static const double lon
Definition: testGeographicLib.cpp:34
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:01:15