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 }
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
main
int main(array< System::String ^> ^)
Definition: dotnet/examples/ManagedCPP/example-Georef.cpp:4
array
Definition: numpy.h:821
lon
static const double lon
Definition: testGeographicLib.cpp:34
NETGeographicLib
Definition: Accumulator.h:13
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:31