dotnet/examples/ManagedCPP/example-Geohash.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 (the wikipedia example)
10  String^ geohash;
11  int maxlen = Geohash::GeohashLength(1.0e-5);
12  for (int len = 0; len <= maxlen; ++len) {
13  Geohash::Forward(lat, lon, len, geohash);
14  Console::WriteLine( geohash );
15  }
16  }
17  {
18  // Sample reverse calculation
19  String^ geohash = "u4pruydqqvj";
20  double lat, lon;
21  for (int i = 0; i <= geohash->Length; ++i) {
22  int len;
23  Geohash::Reverse(geohash->Substring(0, i), lat, lon, len, true);
24  Console::WriteLine(String::Format("Length: {0} Latitude: {1} Longitude: {2}", len, lat, lon ) );
25  }
26  }
27  }
28  catch (GeographicErr^ e) {
29  Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
30  return -1;
31  }
32  return 0;
33 }
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-Geohash.cpp:4
array
Definition: numpy.h:821
len
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2446
lon
static const double lon
Definition: testGeographicLib.cpp:34
NETGeographicLib
Definition: Accumulator.h:13
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
lat
static const double lat
Definition: testGeographicLib.cpp:34


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