open layers example: set raster tile size to 512x512 [#3]

This commit is contained in:
Brandon Liu
2023-04-26 16:33:34 +02:00
parent d15e9a5760
commit fb0ea53ea2

View File

@@ -28,7 +28,8 @@
constructor(options) {
super({
state: "loading",
attributions: options.attributions
attributions: options.attributions,
tileSize: options.tileSize
});
const p = new pmtiles.PMTiles(options.url);
@@ -41,7 +42,6 @@
const blob = new Blob([response.data]);
const src = URL.createObjectURL(blob);
const image = await this.loadImage(src);
image.width = 512;
URL.revokeObjectURL(src);
return image;
});
@@ -50,11 +50,11 @@
}
}
// TODO: tile size 512,512
const rasterLayer = new ol.layer.WebGLTile({
source: new RasterPMTilesSource({
url:"https://r2-public.protomaps.com/protomaps-sample-datasets/terrarium_z9.pmtiles",
attributions:["https://github.com/tilezen/joerd/blob/master/docs/attribution.md"]
attributions:["https://github.com/tilezen/joerd/blob/master/docs/attribution.md"],
tileSize: [512,512]
})
});
@@ -64,7 +64,7 @@
target: 'map',
view: new ol.View({
center: [0,0],
zoom: 0,
zoom: 1,
multiWorld: true
}),
});