Merge pull request #13226 from tschaub/gl-wrap-x

Support the wrapX option for WebGL rendered tile sources
This commit is contained in:
Tim Schaub
2022-01-11 14:23:46 -07:00
committed by GitHub
3 changed files with 30 additions and 1 deletions

View File

@@ -100,7 +100,9 @@ function getRenderExtent(frameState, extent) {
const source =
/** {import("../../source/Tile.js").default} */ layerState.layer.getSource();
if (!source.getWrapX()) {
const gridExtent = source.tileGrid.getExtent();
const gridExtent = source
.getTileGridForProjection(frameState.viewState.projection)
.getExtent();
if (gridExtent) {
extent = getIntersection(extent, gridExtent);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@@ -0,0 +1,27 @@
import Map from '../../../../src/ol/Map.js';
import TileLayer from '../../../../src/ol/layer/WebGLTile.js';
import View from '../../../../src/ol/View.js';
import XYZ from '../../../../src/ol/source/XYZ.js';
document.getElementById('map').style.background = 'green';
new Map({
layers: [
new TileLayer({
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg',
transition: 0,
wrapX: false,
}),
}),
],
target: 'map',
view: new View({
center: [15700000, 2700000],
zoom: 2,
}),
});
render({
message: 'data tiles outside the world are not rendered',
});