diff --git a/src/ol/source/Source.js b/src/ol/source/Source.js index 3176868b90..0f53d1c06e 100644 --- a/src/ol/source/Source.js +++ b/src/ol/source/Source.js @@ -54,7 +54,7 @@ class Source extends BaseObject { /** * @protected - * @type {import("../proj/Projection.js").default} + * @type {import("../proj/Projection.js").default|null} */ this.projection = getProjection(options.projection); @@ -141,7 +141,7 @@ class Source extends BaseObject { /** * Get the projection of the source. - * @return {import("../proj/Projection.js").default} Projection. + * @return {import("../proj/Projection.js").default|null} Projection. * @api */ getProjection() { diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index b09e812d4c..3467ea1e6b 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -281,8 +281,9 @@ class TileSource extends Source { * @protected */ getTileCacheForProjection(projection) { + const sourceProjection = this.getProjection(); assert( - equivalent(this.getProjection(), projection), + sourceProjection === null || equivalent(sourceProjection, projection), 68 // A VectorTile source can only be rendered if it has a projection compatible with the view projection. ); return this.tileCache;