From bc250978993d679b3047be794a3d2be72977c229 Mon Sep 17 00:00:00 2001 From: Petr Sloup Date: Thu, 21 Feb 2019 19:00:07 +0100 Subject: [PATCH] Add tileSize option to ol/source/TileJSON The TileJSON spec does not specify the tile size and there is no TileJSON property specifying the value. Many providers nowadays provide 512x512 with TileJSON. --- src/ol/source/TileJSON.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ol/source/TileJSON.js b/src/ol/source/TileJSON.js index ca3fbcca35..19eb86af7a 100644 --- a/src/ol/source/TileJSON.js +++ b/src/ol/source/TileJSON.js @@ -55,6 +55,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js'; * imageTile.getImage().src = src; * }; * ``` + * @property {number|import("../size.js").Size} [tileSize=[256, 256]] The tile size used by the tile service. * @property {string} [url] URL to the TileJSON file. If not provided, `tileJSON` must be configured. * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. * @property {number} [transition] Duration of the opacity transition for rendering. @@ -90,6 +91,12 @@ class TileJSON extends TileImage { */ this.tileJSON_ = null; + /** + * @type {number|import("../size.js").Size} + * @private + */ + this.tileSize_ = options.tileSize; + if (options.url) { if (options.jsonp) { @@ -168,7 +175,8 @@ class TileJSON extends TileImage { const tileGrid = createXYZ({ extent: extentFromProjection(sourceProjection), maxZoom: maxZoom, - minZoom: minZoom + minZoom: minZoom, + tileSize: this.tileSize_ }); this.tileGrid = tileGrid;