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.
This commit is contained in:
Petr Sloup
2019-02-21 19:00:07 +01:00
parent 6ce499532c
commit bc25097899

View File

@@ -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;