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 }
static const double lat
Exception class for NETGeographicLib.
Definition: numpy.h:543
Array< double, 1, 3 > e(1./3., 0.5, 2.)
int main(array< System::String^>^)
static const double lon
size_t len(handle h)
Definition: pytypes.h:1514


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