Conversions for the World Geographic Reference System (georef) More...
#include <Georef.hpp>
Static Public Member Functions | |
static void | Forward (real lat, real lon, int prec, std::string &georef) |
static int | Precision (real res) |
static Math::real | Resolution (int prec) |
static void | Reverse (const std::string &georef, real &lat, real &lon, int &prec, bool centerp=true) |
Private Types | |
enum | { tile_ = 15, lonorig_ = -180, latorig_ = -90, base_ = 10, baselen_ = 4, maxprec_ = 11, maxlen_ = baselen_ + 2 * maxprec_ } |
typedef Math::real | real |
Private Member Functions | |
Georef () | |
Static Private Attributes | |
static const char *const | degrees_ = "ABCDEFGHJKLMNPQ" |
static const char *const | digits_ = "0123456789" |
static const char *const | lattile_ = "ABCDEFGHJKLM" |
static const char *const | lontile_ = "ABCDEFGHJKLMNPQRSTUVWXYZ" |
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.
|
private |
Definition at line 40 of file Georef.hpp.
|
private |
Enumerator | |
---|---|
tile_ | |
lonorig_ | |
latorig_ | |
base_ | |
baselen_ | |
maxprec_ | |
maxlen_ |
Definition at line 45 of file Georef.hpp.
|
private |
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 22 of file src/Georef.cpp.
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 142 of file Georef.hpp.
|
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 121 of file Georef.hpp.
|
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 63 of file src/Georef.cpp.
|
staticprivate |
Definition at line 44 of file Georef.hpp.
|
staticprivate |
Definition at line 41 of file Georef.hpp.
|
staticprivate |
Definition at line 43 of file Georef.hpp.
|
staticprivate |
Definition at line 42 of file Georef.hpp.