Function PseudoMercator.tryForward
Convert latitude and longitude into the familiar web-map grid.
bool tryForward(
const GeographicCoordinate!T source,
out ProjectedCoordinate!T result
) const pure nothrow @nogc @safe;
The result gives easting and northing in the ellipsoid's linear unit. This is for map display, not accurate surface measurement.
Latitude must lie in the supported closed interval [-88,+88] degrees. Longitude is interpreted on the principal wrapped sheet relative to the configured natural origin. Output uses the ellipsoid linear unit.
Parameters
| Name | Description |
|---|---|
| source | Geographic source coordinate. |
| result | Receives projected easting and northing on success. |
Returns
true when this operation is valid, the source is in the supported
domain, and the projected result is finite and representable;
otherwise false. The out result is initialized on entry; only use its value when the call succeeds.
Example
Example projecting a geographic 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));
ProjectedCoordinate!double result;
assert(projection .tryForward(source, result));
assert(result .easting > 0.0);