summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
commit3c99fde45db83b531c41c350ed4d0ac2a3c40c62 (patch)
treead5257daf9e41556ed73875ab56b69162dffdac1 /debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js
parentAdding upstream version 1.1.0. (diff)
downloadicingaweb2-module-map-c010c2d536b766a9adce8be1b996082d9415fa55.tar.xz
icingaweb2-module-map-c010c2d536b766a9adce8be1b996082d9415fa55.zip
Adding debian version 1.1.0-3.debian/1.1.0-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js')
-rw-r--r--debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js b/debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js
new file mode 100644
index 0000000..b6f6539
--- /dev/null
+++ b/debian/missing-sources/leaflet.js/geo/projection/Projection.SphericalMercator.js
@@ -0,0 +1,42 @@
+import {LatLng} from '../LatLng';
+import {Bounds} from '../../geometry/Bounds';
+import {Point} from '../../geometry/Point';
+
+/*
+ * @namespace Projection
+ * @projection L.Projection.SphericalMercator
+ *
+ * Spherical Mercator projection — the most common projection for online maps,
+ * used by almost all free and commercial tile providers. Assumes that Earth is
+ * a sphere. Used by the `EPSG:3857` CRS.
+ */
+
+export var SphericalMercator = {
+
+ R: 6378137,
+ MAX_LATITUDE: 85.0511287798,
+
+ project: function (latlng) {
+ var d = Math.PI / 180,
+ max = this.MAX_LATITUDE,
+ lat = Math.max(Math.min(max, latlng.lat), -max),
+ sin = Math.sin(lat * d);
+
+ return new Point(
+ this.R * latlng.lng * d,
+ this.R * Math.log((1 + sin) / (1 - sin)) / 2);
+ },
+
+ unproject: function (point) {
+ var d = 180 / Math.PI;
+
+ return new LatLng(
+ (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,
+ point.x * d / this.R);
+ },
+
+ bounds: (function () {
+ var d = 6378137 * Math.PI;
+ return new Bounds([-d, -d], [d, d]);
+ })()
+};