dotnet/NETGeographicLib/Geohash.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
13 #include "Geohash.h"
14 #include "NETGeographicLib.h"
15 
16 using namespace NETGeographicLib;
17 
18 //*****************************************************************************
19 void Geohash::Forward(double lat, double lon, int len, System::String^% geohash)
20 {
21  try
22  {
23  std::string l;
24  GeographicLib::Geohash::Forward( lat, lon, len, l );
25  geohash = gcnew System::String( l.c_str() );
26  }
27  catch ( const std::exception& xcpt )
28  {
29  throw gcnew GeographicErr( xcpt.what() );
30  }
31 }
32 
33 //*****************************************************************************
34 void Geohash::Reverse(System::String^ geohash,
35  [System::Runtime::InteropServices::Out] double% lat,
36  [System::Runtime::InteropServices::Out] double% lon,
37  [System::Runtime::InteropServices::Out] int% len,
38  bool centerp )
39 {
40  try
41  {
42  double llat, llon;
43  int llen;
45  llat, llon, llen, centerp );
46  lat = llat;
47  lon = llon;
48  len = llen;
49  }
50  catch ( const std::exception& err )
51  {
52  throw gcnew GeographicErr( err.what() );
53  }
54 }
55 
56 //*****************************************************************************
58 {
60 }
61 
62 //*****************************************************************************
64 {
66 }
67 
68 //*****************************************************************************
70 {
72 }
73 
74 //*****************************************************************************
75 int Geohash::GeohashLength(double latres, double lonres)
76 {
77  return GeographicLib::Geohash::GeohashLength( latres, lonres );
78 }
79 
80 //*****************************************************************************
82 {
84 }
static Math::real LongitudeResolution(int len)
Definition: Geohash.hpp:113
Header for NETGeographicLib::NETGeographicLib objects.
static const double lat
Exception class for NETGeographicLib.
static int GeohashLength(real res)
Definition: Geohash.hpp:128
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
static const Line3 l(Rot3(), 1, 1)
Header for NETGeographicLib::Geohash class.
static void Reverse(System::String^ geohash, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] int% len, bool centerp)
static int DecimalPrecision(int len)
Definition: Geohash.hpp:167
static void Forward(real lat, real lon, int len, std::string &geohash)
Definition: src/Geohash.cpp:20
static std::string ManagedToUnmanaged(System::String^ s)
static const double lon
static void Forward(double lat, double lon, int len, [System::Runtime::InteropServices::Out] System::String^% geohash)
static void Reverse(const std::string &geohash, real &lat, real &lon, int &len, bool centerp=true)
Definition: src/Geohash.cpp:59
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2244
static Math::real LatitudeResolution(int len)
Definition: Geohash.hpp:99
Header for GeographicLib::Geohash class.


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:18