({ lat, lng })
| 3 | const GOOGLE_TILE_SIZE = 256; |
| 4 | |
| 5 | function latLng2World({ lat, lng }) { |
| 6 | const sin = Math.sin((lat * Math.PI) / 180); |
| 7 | const x = lng / 360 + 0.5; |
| 8 | let y = 0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI; |
| 9 | |
| 10 | y = y < 0 // eslint-disable-line |
| 11 | ? 0 |
| 12 | : y > 1 |
| 13 | ? 1 |
| 14 | : y; |
| 15 | return { x, y }; |
| 16 | } |
| 17 | |
| 18 | function world2LatLng({ x, y }) { |
| 19 | const n = Math.PI - 2 * Math.PI * y; |
no outgoing calls
no test coverage detected