Files
openlayers/examples/cog-blob.js
2022-06-01 23:49:01 +02:00

29 lines
617 B
JavaScript

import GeoTIFF from '../src/ol/source/GeoTIFF.js';
import Map from '../src/ol/Map.js';
import TileLayer from '../src/ol/layer/WebGLTile.js';
fetch('data/example.tif')
.then((response) => response.blob())
.then((blob) => {
const source = new GeoTIFF({
sources: [
{
blob: blob,
},
],
});
const map = new Map({
target: 'map',
layers: [
new TileLayer({
source: source,
}),
],
view: source.getView().then((viewConfig) => {
viewConfig.showFullExtent = true;
return viewConfig;
}),
});
});