10 #if !defined(GEOGRAPHICLIB_GEOHASH_HPP)
11 #define GEOGRAPHICLIB_GEOHASH_HPP 1
17 # pragma warning (push)
18 # pragma warning (disable: 4251)
43 static const int maxlen_ = 18;
44 static const unsigned long long mask_ = 1ULL << 45;
45 static const char*
const lcdigits_;
46 static const char*
const ucdigits_;
67 static void Forward(real lat, real lon,
int len, std::string& geohash);
88 static void Reverse(
const std::string& geohash, real& lat, real& lon,
89 int& len,
bool centerp =
true);
101 len = (std::max)(0, (std::min)(int(maxlen_), len));
102 return ldexp(
real(180), -(5 * len / 2));
115 len = (std::max)(0, (std::min)(int(maxlen_), len));
116 return ldexp(
real(360), -(5 * len - 5 * len / 2));
129 using std::abs; res = abs(res);
130 for (
int len = 0; len < maxlen_; ++len)
131 if (LongitudeResolution(len) <= res)
147 latres = abs(latres);
148 lonres = abs(lonres);
149 for (
int len = 0; len < maxlen_; ++len)
150 if (LatitudeResolution(len) <= latres &&
151 LongitudeResolution(len) <= lonres)
168 using std::floor;
using std::log;
169 return -int(floor(log(LatitudeResolution(len))/log(
Math::real(10))));
176 #if defined(_MSC_VER)
177 # pragma warning (pop)
180 #endif // GEOGRAPHICLIB_GEOHASH_HPP