examples/example-GeoCoords.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::GeoCoords class
2 
3 #include <iostream>
4 #include <exception>
6 
7 using namespace std;
8 using namespace GeographicLib;
9 
10 int main() {
11  try {
12  // Miscellaneous conversions
13  double lat = 33.3, lon = 44.4;
14  GeoCoords c(lat, lon);
15  cout << c.MGRSRepresentation(-3) << "\n";
16  c.Reset("18TWN0050");
17  cout << c.DMSRepresentation() << "\n";
18  cout << c.Latitude() << " " << c.Longitude() << "\n";
19  c.Reset("1d38'W 55d30'N");
20  cout << c.GeoRepresentation() << "\n";
21  }
22  catch (const exception& e) {
23  cerr << "Caught exception: " << e.what() << "\n";
24  return 1;
25  }
26 }
static const double lat
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
Conversion between geographic coordinates.
Definition: GeoCoords.hpp:49
Definition: BFloat16.h:88
Header for GeographicLib::GeoCoords class.
std::string MGRSRepresentation(int prec=0) const
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Math::real Longitude() const
Definition: GeoCoords.hpp:283
std::string GeoRepresentation(int prec=0, bool longfirst=false) const
std::string DMSRepresentation(int prec=0, bool longfirst=false, char dmssep=char(0)) const
static const double lon
Math::real Latitude() const
Definition: GeoCoords.hpp:278
void Reset(const std::string &s, bool centerp=true, bool longfirst=false)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:12