We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75472d1 commit 9ca1407Copy full SHA for 9ca1407
src/utils/utils.js
@@ -6,8 +6,8 @@ function latLng2World({lat, lng}) {
6
const x = (lng / 360 + 0.5);
7
let y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);
8
9
- y = y < -1 // eslint-disable-line
10
- ? -1
+ y = y < 0 // eslint-disable-line
+ ? 0
11
: y > 1
12
? 1
13
: y;
@@ -17,6 +17,8 @@ function latLng2World({lat, lng}) {
17
function world2LatLng({x, y}) {
18
const n = Math.PI - 2 * Math.PI * y;
19
20
+ // TODO test that this is faster
21
+ // 360 * Math.atan(Math.exp((180 - y * 360) * Math.PI / 180)) / Math.PI - 90;
22
return {
23
lat: (180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)))),
24
lng: x * 360 - 180,
0 commit comments