dotnet/examples/ManagedCPP/example-Georef.cpp
Go to the documentation of this file.
1 using namespace System;
2 using namespace NETGeographicLib;
3 
5 {
6  try {
7  {
8  // Sample forward calculation
9  double lat = 57.64911, lon = 10.40744; // Jutland
10  String^ georef;
11  for (int prec = -1; prec <= 11; ++prec) {
12  Georef::Forward(lat, lon, prec, georef);
13  Console::WriteLine(String::Format("Precision: {0} Georef: {1}", prec, georef));
14  }
15  }
16  {
17  // Sample reverse calculation
18  String^ georef = gcnew String("NKLN2444638946");
19  double lat, lon;
20  int prec;
21  Georef::Reverse(georef->Substring(0, 2), lat, lon, prec, true);
22  Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon));
23  Georef::Reverse(georef->Substring(0, 4), lat, lon, prec, true);
24  Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon));
25  Georef::Reverse(georef, lat, lon, prec, true);
26  Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon));
27  }
28  }
29  catch (GeographicErr^ e) {
30  Console::WriteLine(String::Format("Caught Exception {0}", e->Message));
31  return 1;
32  }
33  return 0;
34 }
static const double lat
Exception class for NETGeographicLib.
Definition: numpy.h:543
int main(array< System::String^>^)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static const double lon


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