Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import proj4 from "proj4/lib/core"
import Projection from "proj4/lib/Proj"
import {LatLon} from "../enums"
const mercator = new Projection('GOOGLE')
const wgs84 = new Projection('WGS84')
export const wgs84_mercator = proj4(wgs84, mercator)
const mercator_bounds = {
lon: [-20026376.39, 20026376.39],
lat: [-20048966.10, 20048966.10],
}
const latlon_bounds = {
lon: [-180, 180],
lat: [-85.06, 85.06],
}
export function clip_mercator(low: number, high: number, dimension: LatLon): [number, number] {
const [min, max] = mercator_bounds[dimension]
return [Math.max(low, min), Math.min(high, max)]
import proj4 from "proj4/lib/core"
import Projection from "proj4/lib/Proj"
import {LatLon} from "../enums"
const mercator = new Projection('GOOGLE')
const wgs84 = new Projection('WGS84')
export const wgs84_mercator = proj4(wgs84, mercator)
const mercator_bounds = {
lon: [-20026376.39, 20026376.39],
lat: [-20048966.10, 20048966.10],
}
const latlon_bounds = {
lon: [-180, 180],
lat: [-85.06, 85.06],
}
export function clip_mercator(low: number, high: number, dimension: LatLon): [number, number] {
const [min, max] = mercator_bounds[dimension]