Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -1 pixel buffer for vector tile extent #9877

Merged
merged 1 commit into from Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ol/source/VectorTile.js
Expand Up @@ -190,7 +190,7 @@ class VectorTile extends UrlTile {
const z = urlTileCoord[0];
const resolution = tileGrid.getResolution(z);
// make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
bufferExtent(extent, -1 / resolution, extent);
bufferExtent(extent, -resolution, extent);
const sourceTileGrid = this.tileGrid;
const sourceExtent = sourceTileGrid.getExtent();
if (sourceExtent) {
Expand Down Expand Up @@ -338,7 +338,7 @@ class VectorTile extends UrlTile {
const tileGrid = this.getTileGridForProjection(projection);
const tileExtent = tileGrid.getTileCoordExtent(urlTileCoord);
// make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
bufferExtent(tileExtent, -1 / tileGrid.getResolution(z), tileExtent);
bufferExtent(tileExtent, -tileGrid.getResolution(z), tileExtent);
if (!intersects(sourceExtent, tileExtent)) {
urlTileCoord = null;
}
Expand Down
9 changes: 9 additions & 0 deletions test/spec/ol/source/vectortile.test.js
Expand Up @@ -109,6 +109,15 @@ describe('ol.source.VectorTile', function() {
expect(tile.getState()).to.be(TileState.IDLE);
});

it('creates non-empty tiles for overzoomed resolutions', function() {
const source = new VectorTileSource({
maxZoom: 16
});
const tile = source.getTile(24, 9119385, 5820434, 1, source.getProjection());
tile.load();
expect(tile.getState()).to.be(TileState.LOADING);
});

it('creates new tile when source key changes', function() {
source.setKey('key1');
const tile1 = source.getTile(0, 0, 0, 1, getProjection('EPSG:3857'));
Expand Down