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 }
Math::real Latitude() const
Definition: GeoCoords.hpp:278
static const double lat
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
Conversion between geographic coordinates.
Definition: GeoCoords.hpp:49
Definition: Half.h:150
Header for GeographicLib::GeoCoords class.
std::string GeoRepresentation(int prec=0, bool longfirst=false) const
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::string DMSRepresentation(int prec=0, bool longfirst=false, char dmssep=char(0)) const
std::string MGRSRepresentation(int prec=0) const
static const double lon
void Reset(const std::string &s, bool centerp=true, bool longfirst=false)
Math::real Longitude() const
Definition: GeoCoords.hpp:283


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02