Skip to main content

try_wgs84_to_epsg3857

Function try_wgs84_to_epsg3857 

Source
pub fn try_wgs84_to_epsg3857(
    lon: f64,
    lat: f64,
) -> Result<(f64, f64), ProjectionError>
Expand description

Strictly converts WGS 84 longitude/latitude to Web Mercator metres.

Unlike wgs84_to_epsg3857, this function never clamps. It rejects non-finite coordinates, longitude outside [-180, 180], latitude outside [-90, 90], and latitude outside the finite EPSG:3857 domain.

ยงErrors

Returns ProjectionError when the input is outside the accepted domain.