Function PseudoMercator.tryReverse
Convert web-map grid coordinates back to latitude and longitude.
bool tryReverse(
const ProjectedCoordinate!T source,
out GeographicCoordinate!T result
) const pure nothrow @nogc @safe;
The input must lie on this projection's supported coordinate sheet; it cannot represent geographic positions at the poles.
The represented sheet is the one produced by the corresponding forward operation, including its latitude and wrapped-longitude boundaries.
Parameters
| Name | Description |
|---|---|
| source | Projected easting and northing in the ellipsoid linear unit. |
| result | Receives the geographic coordinate on success. |
Returns
true when this operation is valid and source belongs to the
supported represented sheet with a finite representable inverse;
otherwise false. The out result is initialized on entry; only use its value when the call succeeds.
Example
Example reversing a projected coordinate without throwing.
import geodesy;
const projection = PseudoMercator!double .fromParameters(
wgs84!double(), Longitude!double .fromDegrees(0.0), 0.0, 0.0);
const source = GeographicCoordinate!double .fromComponents(
Latitude!double .fromDegrees(48.20849),
Longitude!double .fromDegrees(16.37208));
const projected = projection .forward(source);
GeographicCoordinate!double result;
assert(projection .tryReverse(projected, result));
assert(result .latitude .degrees > 48.0);