swiss-projection
Version:
Convert from LV03(EPSG:21781) and LV95(EPSG:2056) to WGS84(EPSG:4326)
23 lines (18 loc) • 521 B
text/typescript
import test from 'tape'
import { fromLV03, fromLV95 } from '../fromCH'
const lng = 7.438633
const lat = 46.951082
const isCloseEnough = (actual: number, expected: number): boolean =>
Math.abs(actual - expected) < 0.00001
test('fromLV03', t => {
const r = fromLV03([600000, 200000])
t.true(isCloseEnough(r[0], lng))
t.true(isCloseEnough(r[1], lat))
t.end()
})
test('fromLV95', t => {
const r = fromLV95([2600000, 1200000])
t.true(isCloseEnough(r[0], lng))
t.true(isCloseEnough(r[1], lat))
t.end()
})