Skip to content

Instantly share code, notes, and snippets.

@eliotjordan
eliotjordan / degrees2meters.js
Created April 12, 2022 01:38 — forked from onderaltintas/degrees2meters.js
javascript coordinate conversions between 900913(3857) - 4326(lat lon)
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
//test
lon= -77.035974
lat = 38.898717