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 std::string lcdigits_;
46 static const std::string 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 180 * pow(
real(0.5), 5 * len / 2);
115 len = (std::max)(0, (std::min)(int(maxlen_), len));
116 return 360 * pow(
real(0.5), 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
static Math::real LongitudeResolution(int len)
#define GEOGRAPHICLIB_EXPORT
GeographicLib::Math::real real
static int GeohashLength(real res)
Conversions for geohashes.
Namespace for GeographicLib.
static int GeohashLength(real latres, real lonres)
static int DecimalPrecision(int len)
Header for GeographicLib::Constants class.
static Math::real LatitudeResolution(int len)