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 }
Scalar * y
static const double lat
Definition: BFloat16.h:88
Header for GeographicLib::AlbersEqualArea class.
Albers equal area conic projection.
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const double lon0
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
static const double lon
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 Tue Jul 4 2023 02:34:12