@itwin/core-frontend
Version:
iTwin.js frontend components
22 lines • 1.21 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebMercator = void 0;
const core_geometry_1 = require("@itwin/core-geometry");
/** @internal */
class WebMercator {
// calculates the longitude in EPSG:4326 (WGS84) from the projected x cartesian coordinate in EPSG:3857
static getEPSG4326Lon(x3857) {
return core_geometry_1.Angle.radiansToDegrees(x3857 / core_geometry_1.Constant.earthRadiusWGS84.equator);
}
// calculates the latitude in EPSG:4326 (WGS84) from the projected y cartesian coordinate in EPSG:3857
static getEPSG4326Lat(y3857) {
const y = 2 * Math.atan(Math.exp(y3857 / core_geometry_1.Constant.earthRadiusWGS84.equator)) - (Math.PI / 2);
return core_geometry_1.Angle.radiansToDegrees(y);
}
}
exports.WebMercator = WebMercator;
//# sourceMappingURL=WebMercator.js.map