Go to the documentation of this file.
21 static const real shift = ldexp(
real(1), 45);
22 static const real loneps = 180 / shift;
23 static const real lateps = 90 / shift;
26 +
"d not in [-90d, 90d]");
31 if (
lat == 90)
lat -= lateps / 2;
37 ulon = (
unsigned long long)(
floor(
lon/loneps) + shift),
38 ulat = (
unsigned long long)(
floor(
lat/lateps) + shift);
39 char geohash1[maxlen_];
41 for (
unsigned i = 0;
i < 5 * unsigned(
len);) {
43 byte = (
byte << 1) +
unsigned((ulon & mask_) != 0);
46 byte = (
byte << 1) +
unsigned((ulat & mask_) != 0);
51 geohash1[(
i/5)-1] = lcdigits_[
byte];
56 copy(geohash1, geohash1 +
len, geohash.begin());
60 int&
len,
bool centerp) {
61 static const real shift = ldexp(
real(1), 45);
62 static const real loneps = 180 / shift;
63 static const real lateps = 90 / shift;
64 int len1 =
min(
int(maxlen_),
int(geohash.length()));
66 ((toupper(geohash[0]) ==
'I' &&
67 toupper(geohash[1]) ==
'N' &&
68 toupper(geohash[2]) ==
'V') ||
70 (toupper(geohash[1]) ==
'A' &&
71 toupper(geohash[0]) ==
'N' &&
72 toupper(geohash[2]) ==
'N'))) {
76 unsigned long long ulon = 0, ulat = 0;
77 for (
unsigned k = 0,
j = 0; k < unsigned(len1); ++k) {
80 throw GeographicErr(
"Illegal character in geohash " + geohash);
81 for (
unsigned m = 16;
m;
m >>= 1) {
83 ulon = (ulon << 1) +
unsigned((
byte &
m) != 0);
85 ulat = (ulat << 1) +
unsigned((
byte &
m) != 0);
89 ulon <<= 1; ulat <<= 1;
94 int s = 5 * (maxlen_ - len1);
97 lon = ulon * loneps - 180;
98 lat = ulat * lateps - 90;
static void Forward(real lat, real lon, int len, std::string &geohash)
static T AngNormalize(T x)
static std::string str(T x, int p=-1)
Namespace for GeographicLib.
static const char *const lcdigits_
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Exception handling for GeographicLib.
static int lookup(const std::string &s, char c)
static const char *const ucdigits_
Header for GeographicLib::Geohash class.
Header for GeographicLib::Utility class.
static void Reverse(const std::string &geohash, real &lat, real &lon, int &len, bool centerp=true)
size_t len(handle h)
Get the length of a Python object.
const EIGEN_DEVICE_FUNC FloorReturnType floor() const
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:37