Spherical Mercator math in Javascript