MCPcopy Index your code
hub / github.com/google-map-react/google-map-react / world2LatLng

Function world2LatLng

src/lib/index.js:18–27  ·  view source on GitHub ↗
({ x, y })

Source from the content-addressed store, hash-verified

16}
17
18function world2LatLng({ x, y }) {
19 const n = Math.PI - 2 * Math.PI * y;
20
21 // TODO test that this is faster
22 // 360 * Math.atan(Math.exp((180 - y * 360) * Math.PI / 180)) / Math.PI - 90;
23 return {
24 lat: (180 / Math.PI) * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n))),
25 lng: x * 360 - 180,
26 };
27}
28
29// Thank you wiki https://en.wikipedia.org/wiki/Geographic_coordinate_system
30function latLng2MetersPerDegree({ lat }) {

Callers 1

fitNwSeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected