Skip to content

Instantly share code, notes, and snippets.

View McCulloughRT's full-sized avatar

Ryan McCullough McCulloughRT

View GitHub Profile
@McCulloughRT
McCulloughRT / convertWebMercator.js
Created October 6, 2016 00:16
Convert angular degrees to web mercator coordinates
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]
}
x = -122.6765
y = 45.5231