From d7a3083f607afba2f311b22af44d89d331dc6af5 Mon Sep 17 00:00:00 2001 From: john gravois Date: Wed, 16 Nov 2016 11:56:18 -0800 Subject: [PATCH] display copyright info for TiledMapLayers when map has a customprojection (#888) * display copyright info for custom projections too * make proj4 a global in test suite --- package.json | 2 +- src/Layers/TiledMapLayer.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 486b1c419..486a5393b 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,6 @@ "test": "npm run lint && karma start" }, "semistandard": { - "globals": [ "expect", "L", "XMLHttpRequest", "sinon", "xhr" ] + "globals": [ "expect", "L", "XMLHttpRequest", "sinon", "xhr", "proj4" ] } } diff --git a/src/Layers/TiledMapLayer.js b/src/Layers/TiledMapLayer.js index c3c4c09d6..6c0a57dc7 100644 --- a/src/Layers/TiledMapLayer.js +++ b/src/Layers/TiledMapLayer.js @@ -102,8 +102,7 @@ export var TiledMapLayer = L.TileLayer.extend({ // include 'Powered by Esri' in map attribution setEsriAttribution(map); - if (map.options.crs === L.CRS.EPSG3857 && !this._lodMap) { - this._lodMap = {}; + if (!this._lodMap) { this.metadata(function (error, metadata) { if (!error && metadata.spatialReference) { var sr = metadata.spatialReference.latestWkid || metadata.spatialReference.wkid; @@ -111,7 +110,8 @@ export var TiledMapLayer = L.TileLayer.extend({ this.options.attribution = metadata.copyrightText; map.attributionControl.addAttribution(this.getAttribution()); } - if (sr === 102100 || sr === 3857) { + if (map.options.crs === L.CRS.EPSG3857 && sr === 102100 || sr === 3857) { + this._lodMap = {}; // create the zoom level data var arcgisLODs = metadata.tileInfo.lods; var correctResolutions = TiledMapLayer.MercatorZoomLevels; @@ -130,7 +130,9 @@ export var TiledMapLayer = L.TileLayer.extend({ this.fire('lodmap'); } else { - warn('L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html'); + if (!proj4) { + warn('L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html'); + } } } }, this);