GeographicLib 2.1.2
|
Conversions for the World Geographic Reference System (georef) More...
#include <GeographicLib/Georef.hpp>
Static Public Member Functions | |
static void | Forward (real lat, real lon, int prec, std::string &georef) |
static void | Reverse (const std::string &georef, real &lat, real &lon, int &prec, bool centerp=true) |
static Math::real | Resolution (int prec) |
static int | Precision (real res) |
Conversions for the World Geographic Reference System (georef)
The World Geographic Reference System is described in
It provides a compact string representation of a geographic area (expressed as latitude and longitude). The classes GARS and Geohash implement similar compact representations.
Example of use:
Definition at line 38 of file Georef.hpp.
|
static |
Convert from geographic coordinates to georef.
[in] | lat | latitude of point (degrees). |
[in] | lon | longitude of point (degrees). |
[in] | prec | the precision of the resulting georef. |
[out] | georef | the georef string. |
GeographicErr | if lat is not in [−90°, 90°]. |
std::bad_alloc | if memory for georef can't be allocated. |
prec specifies the precision of georef as follows:
If lat or lon is NaN, then georef is set to "INVALID".
Definition at line 27 of file Georef.cpp.
References GeographicLib::Math::AngNormalize(), GeographicLib::Math::qd, and GeographicLib::Utility::str().
|
static |
Convert from Georef to geographic coordinates.
[in] | georef | the Georef. |
[out] | lat | latitude of point (degrees). |
[out] | lon | longitude of point (degrees). |
[out] | prec | the precision of georef. |
[in] | centerp | if true (the default) return the center georef, otherwise return the south-west corner. |
GeographicErr | if georef is illegal. |
The case of the letters in georef is ignored. prec is in the range [−1, 11] and gives the precision of georef as follows:
If the first 3 characters of georef are "INV", then lat and lon are set to NaN and prec is unchanged.
Definition at line 70 of file Georef.cpp.
References GeographicLib::Utility::lookup(), GeographicLib::Math::NaN(), and GeographicLib::Utility::str().
|
inlinestatic |
The angular resolution of a Georef.
[in] | prec | the precision of the Georef. |
Internally, prec is first put in the range [−1, 11].
Definition at line 133 of file Georef.hpp.
|
inlinestatic |
The Georef precision required to meet a given geographic resolution.
[in] | res | the minimum of resolution in latitude and longitude (degrees). |
The returned length is in the range [0, 11].
Definition at line 154 of file Georef.hpp.