10#if !defined(GEOGRAPHICLIB_GEOHASH_HPP)
11#define GEOGRAPHICLIB_GEOHASH_HPP 1
37 static const int maxlen_ = 18;
38 static const unsigned long long mask_ = 1ULL << 45;
39 static const char*
const lcdigits_;
40 static const char*
const ucdigits_;
61 static void Forward(real lat, real lon,
int len, std::string& geohash);
82 static void Reverse(
const std::string& geohash, real& lat, real& lon,
83 int& len,
bool centerp =
true);
95 len = (std::max)(0, (std::min)(int(maxlen_), len));
96 return ldexp(
real(Math::hd), -(5 * len / 2));
109 len = (std::max)(0, (std::min)(int(maxlen_), len));
110 return ldexp(
real(Math::td), -(5 * len - 5 * len / 2));
123 using std::fabs; res = fabs(res);
124 for (
int len = 0; len < maxlen_; ++len)
125 if (LongitudeResolution(len) <= res)
141 latres = fabs(latres);
142 lonres = fabs(lonres);
143 for (
int len = 0; len < maxlen_; ++len)
144 if (LatitudeResolution(len) <= latres &&
145 LongitudeResolution(len) <= lonres)
162 using std::floor;
using std::log;
163 return -int(floor(log(LatitudeResolution(len))/log(
Math::real(10))));
Header for GeographicLib::Constants class.
#define GEOGRAPHICLIB_EXPORT
GeographicLib::Math::real real
Conversions for geohashes.
static Math::real LatitudeResolution(int len)
static int DecimalPrecision(int len)
static Math::real LongitudeResolution(int len)
static int GeohashLength(real latres, real lonres)
static int GeohashLength(real res)
Namespace for GeographicLib.