Struct PseudoMercator

Prepared bounded Pseudo-Mercator operation with EPSG 1024 parameters.

struct PseudoMercator(T)
  
if (isGeodesyScalar!T);

The forward latitude domain is [-88,+88] degrees. Longitude uses the principal wrapped sheet from -pi inclusive to +pi exclusive. The ellipsoid semi-major axis and false offsets define the projected linear unit; the ellipsoid flattening is retained as semantic state but is not used by EPSG method 1024 equations.

.init is invalid. Prepare the operation once and reuse it for multiple forward/reverse calls.

Properties

NameTypeDescription
ellipsoid[get] Ellipsoid!TSource ellipsoid retained by the operation.
falseEasting[get] TFalse easting in the ellipsoid linear unit.
falseNorthing[get] TFalse northing in the ellipsoid linear unit.
isValid[get] boolTrue when the prepared operation contains valid supported parameters.
longitudeOfNaturalOrigin[get] Longitude!TLongitude of natural origin.

Methods

NameDescription
forward (source) Project a geographic coordinate on the bounded Pseudo-Mercator sheet.
fromParameters (ellipsoid, longitudeOfNaturalOrigin, falseEasting, falseNorthing) Prepare a bounded Pseudo-Mercator operation.
reverse (source) Reverse a projected coordinate from the bounded represented sheet.
tryForward (source, result) Project a geographic coordinate on the bounded Pseudo-Mercator sheet.
tryFromParameters (ellipsoid, longitudeOfNaturalOrigin, falseEasting, falseNorthing, result) Prepare a bounded Pseudo-Mercator operation without throwing.
tryReverse (source, result) Reverse a projected coordinate from the bounded represented sheet.

Example

Example using struct PseudoMercator(T) if (isGeodesyScalar!T).

import geodesy;

const projection = PseudoMercator!double.fromParameters(
    wgs84!double(),
    Longitude!double.fromDegrees(0.0),
    0.0,
    0.0);

const vienna = GeographicCoordinate!double.fromComponents(
    Latitude!double.fromDegrees(48.20849),
    Longitude!double.fromDegrees(16.37208));

const xy = projection.forward(vienna);
const back = projection.reverse(xy);
assert(back.latitude.degrees > 48.0);