GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
|
Methods for working with Mercator-projected coordinates. More...
#include <Mercator.h>
Static Public Member Functions | |
static int32_t | xFromLon (double lon) noexcept |
Converts longitude (in WGS-84 degrees) to a Mercator X-coordinate. | |
static int32_t | xFromLon100nd (int lon) noexcept |
Converts WGS-84 longitude (in 100-nanodegree increments) to a Mercator X-coordinate. | |
static int32_t | yFromLat (double lat) noexcept |
Converts latitude (in WGS-84 degrees) to a Mercator Y-coordinate. | |
static int32_t | yFromLat100nd (int lat) noexcept |
Converts WGS-84 latitude (in 100-nanodegree increments) to a Mercator Y-coordinate. | |
static double | roundTo100nd (double deg) noexcept |
static double | lonFromX (double x) noexcept |
Converts a Mercator X-coordinate to longitude (in WGS-84 degrees). | |
static double | roundedLonFromX (double x) noexcept |
Converts a Mercator X-coordinate to longitude (in WGS-84 degrees, rounded to 7 digits of precision). | |
static double | latFromY (double y) noexcept |
Converts a Mercator Y-coordinate to latitude (in WGS-84 degrees). | |
static double | roundedLatFromY (double y) noexcept |
Converts a Mercator Y-coordinate to latitude (in WGS-84 degrees, rounded to 7 digits of precision). | |
static double | scale (double y) noexcept |
Calculates the scaling factor for the given Y-coordinate. | |
static double | metersPerUnitAtY (double y) noexcept |
Calculates the number of meters each Mercator unit represents at the given Y-coordinate. | |
static double | unitsFromMeters (double meters, double atY) noexcept |
Calculates the number of Mercator units represented by the given distance (in meters), at the given Y-coordinate. | |
Static Public Attributes | |
static constexpr double | MAP_WIDTH = 4'294'967'294.9999 |
static constexpr double | EARTH_CIRCUMFERENCE = 40'075'016.68558 |
static constexpr double | MIN_LAT = -85.0511288 |
static constexpr double | MAX_LAT = 85.0511287 |
static constexpr int32_t | MIN_LAT_100ND = -850511288 |
static constexpr int32_t | MAX_LAT_100ND = 850511287 |
static constexpr int32_t | MIN_Y = INT_MIN |
static constexpr int32_t | MAX_Y = INT_MAX - 1 |
Methods for working with Mercator-projected coordinates.
GeoDesk uses a Pseudo-Mercator projection that projects coordinates onto a square Cartesian plane 2^32 units wide/tall (in essence, the value range fully uses a 32-bit signed int). This projection is compatible with Web Mercator EPSG:3857, except that instead of meters at the Equator, it uses a made-up unit called "imp" ("integer, Mercator-projected").
|
inlinestaticnoexcept |
Converts a Mercator Y-coordinate to latitude (in WGS-84 degrees).
|
inlinestaticnoexcept |
Converts a Mercator X-coordinate to longitude (in WGS-84 degrees).
|
inlinestaticnoexcept |
Calculates the number of meters each Mercator unit represents at the given Y-coordinate.
The Y-coordinate must be between INT_MIN
and INT_MAX
(inclusive), or the result will be undefined.
y | valid Y-coordinate |
|
inlinestaticnoexcept |
Converts a Mercator Y-coordinate to latitude (in WGS-84 degrees, rounded to 7 digits of precision).
|
inlinestaticnoexcept |
Converts a Mercator X-coordinate to longitude (in WGS-84 degrees, rounded to 7 digits of precision).
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
Calculates the scaling factor for the given Y-coordinate.
This factor is 1
at the equator and progressively increases towards the polar regions, and is used to compensate for the distortion introduced by the Mercator projection.
|
inlinestaticnoexcept |
Calculates the number of Mercator units represented by the given distance (in meters), at the given Y-coordinate.
The Y-coordinate must be between INT_MIN
and INT_MAX
(inclusive), or the result will be undefined.
meters | distance in meters |
atY | valid Y-coordinate |
|
inlinestaticnoexcept |
Converts longitude (in WGS-84 degrees) to a Mercator X-coordinate.
|
inlinestaticnoexcept |
Converts WGS-84 longitude (in 100-nanodegree increments) to a Mercator X-coordinate.
|
inlinestaticnoexcept |
Converts latitude (in WGS-84 degrees) to a Mercator Y-coordinate.
|
inlinestaticnoexcept |
Converts WGS-84 latitude (in 100-nanodegree increments) to a Mercator Y-coordinate.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |