1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| import GeoTIFF from 'ol/source/GeoTIFF.js'; import Map from 'ol/Map.js'; import TileGrid from 'ol/tilegrid/TileGrid.js'; import View from 'ol/View.js'; import WebGLTileLayer from 'ol/layer/WebGLTile.js'; import {sourcesFromTileGrid} from 'ol/source.js';
const tileGrid = new TileGrid({ extent: [-180, -90, 180, 90], resolutions: [0.703125, 0.3515625, 0.17578125, 8.7890625e-2, 4.39453125e-2], tileSizes: [ [512, 256], [1024, 512], [2048, 1024], [4096, 2048], [4096, 4096], ], });
const pyramid = new WebGLTileLayer({ sources: sourcesFromTileGrid( tileGrid, ([z, x, y]) => new GeoTIFF({ sources: [ { url: `https://s2downloads.eox.at/demo/EOxCloudless/2019/rgb/${z}/${y}/${x}.tif`, }, ], }) ), });
const map = new Map({ target: 'map', layers: [pyramid], view: new View({ projection: 'EPSG:4326', center: [0, 0], zoom: 0, showFullExtent: true, }), });
|