examples/example-UTMUPS.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::UTMUPS class
2 
3 #include <iostream>
4 #include <iomanip>
5 #include <exception>
6 #include <string>
8 
9 using namespace std;
10 using namespace GeographicLib;
11 
12 int main() {
13  try {
14  // See also example-GeoCoords.cpp
15  {
16  // Sample forward calculation
17  double lat = 33.3, lon = 44.4; // Baghdad
18  int zone;
19  bool northp;
20  double x, y;
21  UTMUPS::Forward(lat, lon, zone, northp, x, y);
22  string zonestr = UTMUPS::EncodeZone(zone, northp);
23  cout << fixed << setprecision(2)
24  << zonestr << " " << x << " " << y << "\n";
25  }
26  {
27  // Sample reverse calculation
28  string zonestr = "38n";
29  int zone;
30  bool northp;
31  UTMUPS::DecodeZone(zonestr, zone, northp);
32  double x = 444e3, y = 3688e3;
33  double lat, lon;
34  UTMUPS::Reverse(zone, northp, x, y, lat, lon);
35  cout << lat << " " << lon << "\n";
36  }
37  }
38  catch (const exception& e) {
39  cerr << "Caught exception: " << e.what() << "\n";
40  return 1;
41  }
42 }
Scalar * y
static const double lat
Header for GeographicLib::UTMUPS class.
Definition: Half.h:150
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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 Sat May 8 2021 02:42:02