Skip to content

Commit

Permalink
display copyright info for TiledMapLayers when map has a customprojec…
Browse files Browse the repository at this point in the history
…tion (#888)

* display copyright info for custom projections too

* make proj4 a global in test suite
  • Loading branch information
jgravois authored Nov 16, 2016
1 parent ac69bea commit d7a3083
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
"test": "npm run lint && karma start"
},
"semistandard": {
"globals": [ "expect", "L", "XMLHttpRequest", "sinon", "xhr" ]
"globals": [ "expect", "L", "XMLHttpRequest", "sinon", "xhr", "proj4" ]
}
}
10 changes: 6 additions & 4 deletions src/Layers/TiledMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ 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;
if (!this.options.attribution && map.attributionControl && metadata.copyrightText) {
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;
Expand All @@ -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);
Expand Down

0 comments on commit d7a3083

Please sign in to comment.