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 }
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
main
int main()
Definition: examples/example-UTMUPS.cpp:12
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
UTMUPS.hpp
Header for GeographicLib::UTMUPS class.
y
Scalar * y
Definition: level1_cplx_impl.h:124
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 Mon Jul 1 2024 03:01:15