Merge pull request #11454 from ahocevar/vectortile-projection

VectorTile source projection has to match the view projection
This commit is contained in:
Andreas Hocevar
2020-08-24 19:15:14 +02:00
committed by GitHub
2 changed files with 11 additions and 7 deletions
+4
View File
@@ -249,3 +249,7 @@ This is done by providing adequate shaders using the `hitVertexShader` and `hitF
### 67 ### 67
A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both. A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.
### 68
Data from this source can only be rendered if it has a projection compatible with the view projection.
+6 -6
View File
@@ -6,6 +6,7 @@ import Source from './Source.js';
import TileCache from '../TileCache.js'; import TileCache from '../TileCache.js';
import TileState from '../TileState.js'; import TileState from '../TileState.js';
import {abstract} from '../util.js'; import {abstract} from '../util.js';
import {assert} from '../asserts.js';
import {equivalent} from '../proj.js'; import {equivalent} from '../proj.js';
import {getKeyZXY, withinExtentAndZ} from '../tilecoord.js'; import {getKeyZXY, withinExtentAndZ} from '../tilecoord.js';
import { import {
@@ -250,12 +251,11 @@ class TileSource extends Source {
* @protected * @protected
*/ */
getTileCacheForProjection(projection) { getTileCacheForProjection(projection) {
const thisProj = this.getProjection(); assert(
if (thisProj && !equivalent(thisProj, projection)) { equivalent(this.getProjection(), projection),
return null; 68 // A VectorTile source can only be rendered if it has a projection compatible with the view projection.
} else { );
return this.tileCache; return this.tileCache;
}
} }
/** /**