21 const char* spaces =
" \t\n\v\f\r,";
22 for (string::size_type pos0 = 0, pos1; pos0 != string::npos;) {
23 pos1 = s.find_first_not_of(spaces, pos0);
24 if (pos1 == string::npos)
26 pos0 = s.find_first_of(spaces, pos1);
27 sa.push_back(s.substr(pos1, pos0 == string::npos ? pos0 : pos0 - pos1));
31 MGRS::Reverse(sa[0], _zone, _northp, _easting, _northing, prec, centerp);
33 _lat, _long, _gamma, _k);
34 }
else if (sa.size() == 2) {
38 _zone, _northp, _easting, _northing, _gamma, _k);
39 }
else if (sa.size() == 3) {
40 unsigned zoneind, coordind;
41 if (sa[0].
size() > 0 && isalpha(sa[0][sa[0].
size() - 1])) {
44 }
else if (sa[2].
size() > 0 && isalpha(sa[2][sa[2].
size() - 1])) {
49 +
" of the form UTM/UPS Zone + Hemisphere" 50 +
" (ex: 38n, 09s, n)");
52 for (
unsigned i = 0;
i < 2; ++
i)
53 (
i ? _northing : _easting) = Utility::val<real>(sa[coordind +
i]);
55 _lat, _long, _gamma, _k);
58 throw GeographicErr(
"Coordinate requires 1, 2, or 3 elements");
65 os << fixed << setprecision(prec);
66 real a = longfirst ? _long : _lat;
67 real b = longfirst ? _lat : _long;
83 return DMS::Encode(longfirst ? _long : _lat,
unsigned(prec),
85 " " +
DMS::Encode(longfirst ? _lat : _long,
unsigned(prec),
91 prec =
max(-1,
min(6, prec) + 5);
93 MGRS::Forward(_zone, _northp, _easting, _northing, _lat, prec, mgrs);
99 prec =
max(-1,
min(6, prec) + 5);
101 MGRS::Forward(_alt_zone, _northp, _alt_easting, _alt_northing, _lat, prec,
107 real easting,
real northing,
int prec,
108 bool abbrev, std::string& utm) {
116 if (prec < 0 &&
abs(easting / scale) >
real(0.5))
117 os << setw(-prec) << 0;
122 if (prec < 0 &&
abs(northing / scale) >
real(0.5))
123 os << setw(-prec) << 0;
131 UTMUPSString(_zone, _northp, _easting, _northing, prec, abbrev, utm);
140 _zone, northp, e, n, z);
142 UTMUPSString(_zone, northp, e, n, prec, abbrev, utm);
148 UTMUPSString(_alt_zone, _northp, _alt_easting, _alt_northing, prec,
158 _alt_zone, northp, e, n, z);
160 UTMUPSString(_alt_zone, northp, e, n, prec, abbrev, utm);
165 if (_lat == 0 || (_northp && _lat >= 0) || (!_northp && _lat < 0) ||
static T AngNormalize(T x)
static std::string EncodeZone(int zone, bool northp, bool abbrev=true)
Header for GeographicLib::Utility class.
static bool isfinite(T x)
static void Transfer(int zonein, bool northpin, real xin, real yin, int zoneout, bool northpout, real &xout, real &yout, int &zone)
std::string AltUTMUPSRepresentation(int prec=0, bool abbrev=true) const
Header for GeographicLib::GeoCoords class.
Header for GeographicLib::MGRS class.
static int extra_digits()
static void Forward(real lat, real lon, int &zone, bool &northp, real &x, real &y, real &gamma, real &k, int setzone=STANDARD, bool mgrslimits=false)
static std::string Encode(real angle, component trailing, unsigned prec, flag ind=NONE, char dmssep=char(0))
std::string GeoRepresentation(int prec=0, bool longfirst=false) const
std::string AltMGRSRepresentation(int prec=0) const
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static void DecodeZone(const std::string &zonestr, int &zone, bool &northp)
static std::string str(T x, int p=-1)
static void DecodeLatLon(const std::string &dmsa, const std::string &dmsb, real &lat, real &lon, bool longfirst=false)
static void Reverse(int zone, bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k, bool mgrslimits=false)
static void Reverse(const std::string &mgrs, int &zone, bool &northp, real &x, real &y, int &prec, bool centerp=true)
Exception handling for GeographicLib.
ofstream os("timeSchurFactors.csv")
std::string DMSRepresentation(int prec=0, bool longfirst=false, char dmssep=char(0)) const
std::string MGRSRepresentation(int prec=0) const
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 y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics scale
static Math::real UTMShift()
Jet< T, N > pow(const Jet< T, N > &f, double g)
static void UTMUPSString(int zone, bool northp, real easting, real northing, int prec, bool abbrev, std::string &utm)
void Reset(const std::string &s, bool centerp=true, bool longfirst=false)
static void Forward(int zone, bool northp, real x, real y, int prec, std::string &mgrs)
std::string UTMUPSRepresentation(int prec=0, bool abbrev=true) const
Header for GeographicLib::DMS class.