[fusion-commits] r3059 - trunk/lib/OpenLayers
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Apr 3 05:49:14 PDT 2023
Author: jng
Date: 2023-04-03 05:49:14 -0700 (Mon, 03 Apr 2023)
New Revision: 3059
Modified:
trunk/lib/OpenLayers/OpenLayers.js
Log:
Patch OpenLayers.Layer.Bing to throw a better error when initLayer() is called with metadata that has a error response (ie. We didn't specify an API key)
Modified: trunk/lib/OpenLayers/OpenLayers.js
===================================================================
--- trunk/lib/OpenLayers/OpenLayers.js 2023-03-30 08:38:01 UTC (rev 3058)
+++ trunk/lib/OpenLayers/OpenLayers.js 2023-04-03 12:49:14 UTC (rev 3059)
@@ -10826,8 +10826,8 @@
}
}
}
- zoom = Math.max(0, i-1);
- if (zoom == 0 && this.CLASS_NAME.indexOf('OpenLayers.Layer.Bing') > -1)
+ zoom = Math.max(0, i-1);
+ if (zoom == 0 && this.CLASS_NAME.indexOf('OpenLayers.Layer.Bing') > -1)
zoom = 1;
}
return zoom;
@@ -42706,11 +42706,11 @@
});
} else {
- url = this.getFullRequestString(
- {
- tilecol: colidx,
- tilerow: rowidx,
- scaleindex: this.resolutions.length - this.map.zoom - 1
+ url = this.getFullRequestString(
+ {
+ tilecol: colidx,
+ tilerow: rowidx,
+ scaleindex: this.resolutions.length - this.map.zoom - 1
});
}
}
@@ -56580,6 +56580,10 @@
* Sets layer properties according to the metadata provided by the API
*/
initLayer: function() {
+ // JN 3/4/2023: Check for non-successful metadata and throw a better error if that's the case
+ if (this.metadata.statusCode != 200 && this.metadata.errorDetails) {
+ throw new Error("Error inititalizing bing layer: " + this.metadata.errorDetails.join("\n"));
+ }
var res = this.metadata.resourceSets[0].resources[0];
var url = res.imageUrl.replace("{quadkey}", "${quadkey}");
url = url.replace("{culture}", this.culture);
More information about the fusion-commits
mailing list