Merge pull request #6819 from ahocevar/vectortile-getfeatures

Adjust/fix API for working with vector tile features
This commit is contained in:
Andreas Hocevar
2017-05-18 11:13:30 +02:00
committed by GitHub
7 changed files with 62 additions and 17 deletions

View File

@@ -13,7 +13,8 @@ describe('ol.source.VectorTile', function() {
var source = new ol.source.VectorTile({
format: format,
tileGrid: ol.tilegrid.createXYZ({tileSize: 512}),
url: '{z}/{x}/{y}.pbf'
tilePixelRatio: 8,
url: 'spec/ol/data/{z}-{x}-{y}.vector.pbf'
});
var tile;
@@ -47,4 +48,21 @@ describe('ol.source.VectorTile', function() {
});
});
describe('Tile load events', function() {
it('triggers tileloadstart and tileloadend with ol.VectorTile', function(done) {
tile = source.getTile(14, 8938, -5681, 1, ol.proj.get('EPSG:3857'));
var started = false;
source.on('tileloadstart', function() {
started = true;
});
source.on('tileloadend', function(e) {
expect(started).to.be(true);
expect(e.tile).to.be.a(ol.VectorTile);
expect(e.tile.getFeatures().length).to.be(1327);
done();
});
tile.load();
});
});
});