From 00166b9c4f053e3fbbdd7f7531fba078a14e4fcf Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Thu, 28 Nov 2013 00:59:39 +0200 Subject: [PATCH] proper EPSG:4326 with 2x1 root, fixes #1207 --- debug/map/wms-marble.html | 2 +- spec/suites/geo/CRSSpec.js | 4 ++-- src/geo/crs/CRS.EPSG3395.js | 4 +++- src/geo/crs/CRS.EPSG4326.js | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/debug/map/wms-marble.html b/debug/map/wms-marble.html index 41703bc2..5251d771 100644 --- a/debug/map/wms-marble.html +++ b/debug/map/wms-marble.html @@ -20,7 +20,7 @@ var bluemarble = new L.TileLayer.WMS("http://maps.opengeo.org/geowebcache/service/wms", { layers: 'bluemarble', attribution: "Data © NASA Blue Marble, image service by OpenGeo", - minZoom: 2, + minZoom: 0, maxZoom: 5 }); diff --git a/spec/suites/geo/CRSSpec.js b/spec/suites/geo/CRSSpec.js index fefc00ac..eaa62d82 100644 --- a/spec/suites/geo/CRSSpec.js +++ b/spec/suites/geo/CRSSpec.js @@ -70,9 +70,9 @@ describe("CRS.EPSG4326", function () { crsSize; for (i = 0; i <= 22; i++) { crsSize = crs.getSize(i); - expect(crsSize.x).equal(worldSize); + expect(crsSize.x).equal(worldSize * 2); // Lat bounds are half as high (-90/+90 compared to -180/+180) - expect(crsSize.y).equal(worldSize / 2); + expect(crsSize.y).equal(worldSize); worldSize *= 2; } }); diff --git a/src/geo/crs/CRS.EPSG3395.js b/src/geo/crs/CRS.EPSG3395.js index 786dec91..260f098b 100644 --- a/src/geo/crs/CRS.EPSG3395.js +++ b/src/geo/crs/CRS.EPSG3395.js @@ -10,5 +10,7 @@ L.CRS.EPSG3395 = L.extend({}, L.CRS, { scale = 0.5 / (Math.PI * r); return new L.Transformation(scale, 0.5, -scale, 0.5); - }()) + }()), + + wrapLng: true }); diff --git a/src/geo/crs/CRS.EPSG4326.js b/src/geo/crs/CRS.EPSG4326.js index bcd33bda..cf40ddd7 100644 --- a/src/geo/crs/CRS.EPSG4326.js +++ b/src/geo/crs/CRS.EPSG4326.js @@ -6,5 +6,7 @@ L.CRS.EPSG4326 = L.extend({}, L.CRS, { code: 'EPSG:4326', projection: L.Projection.LonLat, - transformation: new L.Transformation(1 / 360, 0.5, -1 / 360, 0.5) + transformation: new L.Transformation(1 / 180, 1, -1 / 180, 0.5), + + wrapLng: true });