25 +
"d not in [-90d, 90d]");
32 prec =
max(-1,
min(
int(maxprec_), prec));
33 if (prec == 1) ++prec;
36 GEOGRAPHICLIB_STATIC_ASSERT(numeric_limits<long long>::digits >= 45,
37 "long long not wide enough to store 21600e9");
38 const long long m = 60000000000LL;
40 x = (
long long)(
floor(lon *
real(m))) - lonorig_ * m,
41 y = (
long long)(
floor(lat *
real(m))) - latorig_ * m;
42 int ilon =
int(x / m);
int ilat =
int(
y / m);
43 char georef1[maxlen_];
44 georef1[0] = lontile_[ilon / tile_];
45 georef1[1] = lattile_[ilat / tile_];
47 georef1[2] = degrees_[ilon % tile_];
48 georef1[3] = degrees_[ilat % tile_];
50 x -= m * ilon;
y -= m * ilat;
51 long long d = (
long long)
pow(
real(base_), maxprec_ - prec);
53 for (
int c = prec;
c--;) {
54 georef1[baselen_ +
c ] = digits_[x % base_]; x /= base_;
55 georef1[baselen_ +
c + prec] = digits_[
y % base_];
y /= base_;
59 georef.resize(baselen_ + 2 * prec);
60 copy(georef1, georef1 + baselen_ + 2 * prec, georef.begin());
64 int& prec,
bool centerp) {
65 int len =
int(georef.length());
67 toupper(georef[0]) ==
'I' &&
68 toupper(georef[1]) ==
'N' &&
69 toupper(georef[2]) ==
'V') {
73 if (len < baselen_ - 2)
74 throw GeographicErr(
"Georef must start with at least 2 letters " 76 int prec1 = (2 + len - baselen_) / 2 - 1;
80 throw GeographicErr(
"Bad longitude tile letter in georef " + georef);
81 real lon1 = k + lonorig_ / tile_;
84 throw GeographicErr(
"Bad latitude tile letter in georef " + georef);
85 real lat1 = k + latorig_ / tile_;
91 throw GeographicErr(
"Bad longitude degree letter in georef " + georef);
92 lon1 = lon1 * tile_ + k;
94 throw GeographicErr(
"Missing latitude degree letter in georef " 98 throw GeographicErr(
"Bad latitude degree letter in georef " + georef);
99 lat1 = lat1 * tile_ + k;
101 if (georef.find_first_not_of(digits_, baselen_) != string::npos)
102 throw GeographicErr(
"Non digits in trailing portion of georef " 103 + georef.substr(baselen_));
105 throw GeographicErr(
"Georef must end with an even number of digits " 106 + georef.substr(baselen_));
108 throw GeographicErr(
"Georef needs at least 4 digits for minutes " 109 + georef.substr(baselen_));
110 if (prec1 > maxprec_)
112 +
" digits in georef " 113 + georef.substr(baselen_));
114 for (
int i = 0;
i < prec1; ++
i) {
115 int m =
i ? base_ : 6;
120 if (!(
i || (x < m &&
y < m)))
121 throw GeographicErr(
"Minutes terms in georef must be less than 60 " 122 + georef.substr(baselen_));
129 unit *= 2; lat1 = 2 * lat1 + 1; lon1 = 2 * lon1 + 1;
131 lat = (tile_ * lat1) / unit;
132 lon = (tile_ * lon1) / unit;
static T AngNormalize(T x)
static const char *const lattile_
Header for GeographicLib::Georef class.
Header for GeographicLib::Utility class.
static const char *const lontile_
static const char *const degrees_
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
static void Forward(real lat, real lon, int prec, std::string &georef)
Namespace for GeographicLib.
static const char *const digits_
static std::string str(T x, int p=-1)
static void Reverse(const std::string &georef, real &lat, real &lon, int &prec, bool centerp=true)
Exception handling for GeographicLib.
static int lookup(const std::string &s, char c)
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Jet< T, N > pow(const Jet< T, N > &f, double g)
size_t len(handle h)
Get the length of a Python object.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x