From fd0d6ff6f66207e09f89abb1e82765b06b7c8f7b Mon Sep 17 00:00:00 2001 From: William Wall Date: Thu, 20 Sep 2018 16:25:48 -0600 Subject: [PATCH 1/2] Define BingMapsImageryMetadataResponse type --- src/ol/source/BingMaps.js | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/ol/source/BingMaps.js b/src/ol/source/BingMaps.js index bbfbbbe557..914e64288b 100644 --- a/src/ol/source/BingMaps.js +++ b/src/ol/source/BingMaps.js @@ -45,6 +45,47 @@ const TOS_ATTRIBUTION = '} resourceSets The array of resource sets + */ + + +/** + * @typedef {Object} ResourceSet + * @property {Array} resources + */ + + +/** + * @typedef {Object} Resource + * @property {number} imageHeight The image height + * @property {number} imageWidth The image width + * @property {number} zoomMin The minimum zoom level + * @property {string} imageUrl The image URL + * @property {Array} imageUrlSubdomains The image URL subdomains for rotation + * @property {Array} [imageryProviders] The array of ImageryProviders + */ + + +/** + * @typedef {Object} ImageryProvider + * @property {Array} coverageAreas The coverage areas + * @property {string} [attribution] The attribution + */ + + +/** + * @typedef {Object} CoverageArea + * @property {number} zoomMin The minimum zoom + * @property {number} zoomMax The maximum zoom + * @property {Array} bbox The coverage bounding box + */ + + /** * @classdesc * Layer source for Bing Maps tile data. From 1c10bbf94cf6d5641f23b82cb3b1e17577515830 Mon Sep 17 00:00:00 2001 From: William Wall Date: Fri, 21 Sep 2018 11:57:25 -0600 Subject: [PATCH 2/2] Fix arithmetic error on potential array And also add zoomMax to response type --- src/ol/source/BingMaps.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ol/source/BingMaps.js b/src/ol/source/BingMaps.js index 914e64288b..c12e5d9aa7 100644 --- a/src/ol/source/BingMaps.js +++ b/src/ol/source/BingMaps.js @@ -65,6 +65,7 @@ const TOS_ATTRIBUTION = '} imageUrlSubdomains The image URL subdomains for rotation * @property {Array} [imageryProviders] The array of ImageryProviders @@ -191,13 +192,16 @@ class BingMaps extends TileImage { const sourceProjection = this.getProjection(); const extent = extentFromProjection(sourceProjection); + const scale = this.hidpi_ ? 2 : 1; const tileSize = resource.imageWidth == resource.imageHeight ? - resource.imageWidth : [resource.imageWidth, resource.imageHeight]; + resource.imageWidth / scale : + [resource.imageWidth / scale, resource.imageHeight / scale]; + const tileGrid = createXYZ({ extent: extent, minZoom: resource.zoomMin, maxZoom: maxZoom, - tileSize: tileSize / (this.hidpi_ ? 2 : 1) + tileSize: tileSize }); this.tileGrid = tileGrid;