10 #if !defined(GEOGRAPHICLIB_GEOHASH_HPP)
11 #define GEOGRAPHICLIB_GEOHASH_HPP 1
17 # pragma warning (push)
18 # pragma warning (disable: 4251)
21 namespace GeographicLib {
42 static const int maxlen_ = 18;
43 static const unsigned long long mask_ = 1ULL << 45;
44 static const int decprec_[];
45 static const real loneps_;
46 static const real lateps_;
47 static const real shift_;
48 static const std::string lcdigits_;
49 static const std::string ucdigits_;
71 static void Forward(real lat, real lon,
int len, std::string& geohash);
90 static void Reverse(
const std::string& geohash, real& lat, real& lon,
91 int& len,
bool centerp =
true);
102 len = (std::max)(0, (std::min)(int(maxlen_), len));
103 return 180 * std::pow(0.5, 5 * len / 2);
115 len = (std::max)(0, (std::min)(int(maxlen_), len));
116 return 360 * std::pow(0.5, 5 * len - 5 * len / 2);
130 for (
int len = 0; len < maxlen_; ++len)
131 if (LongitudeResolution(len) <= res)
146 latres = std::abs(latres);
147 lonres = std::abs(lonres);
148 for (
int len = 0; len < maxlen_; ++len)
149 if (LatitudeResolution(len) <= latres &&
150 LongitudeResolution(len) <= lonres)
167 return -int(std::floor(std::log(LatitudeResolution(len))/
175 #if defined(_MSC_VER)
176 # pragma warning (pop)
179 #endif // GEOGRAPHICLIB_GEOHASH_HPP
static Math::real LongitudeResolution(int len)
#define GEOGRAPHICLIB_EXPORT
GeographicLib::Math::real real
static int GeohashLength(real res)
Conversions for geohashes.
static int GeohashLength(real latres, real lonres)
static int DecimalPrecision(int len)
Header for GeographicLib::Constants class.
static Math::real LatitudeResolution(int len)