Add rendering tests for MVT, comparing with GeoJSON

This commit is contained in:
Andreas Hocevar
2020-06-23 21:20:46 +02:00
parent 79c318d262
commit 18e2044b58
4 changed files with 58 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -0,0 +1,47 @@
import {Feature, Map, View} from '../../../src/ol/index.js';
import {GeoJSON, MVT} from '../../../src/ol/format.js';
import {VectorTile as VectorTileLayer} from '../../../src/ol/layer.js';
import {VectorTile as VectorTileSource} from '../../../src/ol/source.js';
import {fromLonLat} from '../../../src/ol/proj.js';
const center = fromLonLat([0.26, 24.08]);
const map = new Map({
layers: [
new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
url: '/data/{z}-{x}-{y}.mvt',
minZoom: 7,
maxZoom: 7,
}),
}),
new VectorTileLayer({
source: new VectorTileSource({
format: new MVT({
featureClass: Feature,
}),
url: '/data/{z}-{x}-{y}.mvt',
minZoom: 7,
maxZoom: 7,
}),
}),
new VectorTileLayer({
source: new VectorTileSource({
format: new GeoJSON(),
url: '/data/{z}-{x}-{y}.geojson',
minZoom: 7,
maxZoom: 7,
}),
}),
],
target: 'map',
view: new View({
center: center,
zoom: 10,
}),
});
map.getTargetElement().style.background = 'gray';
render();