|
9 | 9 | */
|
10 | 10 | import { Vector as VectorLayer, VectorTile as VectorTileLayer, Image as ImageLayer } from 'ol/layer';
|
11 | 11 | import { XYZ, TileWMS, Vector as VectorSource, VectorTile as VectorTileSource, TileArcGISRest, ImageArcGISRest } from 'ol/source';
|
| 12 | +import { PMTilesVectorSource, PMTilesRasterSource } from "ol-pmtiles"; |
12 | 13 | import GeoTIFF from 'ol/source/GeoTIFF.js';
|
13 | 14 | import TileLayer from 'ol/layer/WebGLTile.js';
|
| 15 | +import WebGLTile from "ol/layer/WebGLTile"; |
14 | 16 | import MVT from 'ol/format/MVT';
|
15 | 17 | import GeoJSON from 'ol/format/GeoJSON';
|
16 | 18 | import { geoJsonStyleFunction } from './Styles'
|
@@ -161,7 +163,7 @@ export function createLayer(layerConfig, map) {
|
161 | 163 | sources: [
|
162 | 164 | {
|
163 | 165 | url: layerConfig.source.url,
|
164 |
| - tileSize: 512, |
| 166 | + tileSize: layerConfig.source.url || [512, 512], |
165 | 167 | nodata: 0,
|
166 | 168 | },
|
167 | 169 | ],
|
@@ -240,7 +242,47 @@ export function createLayer(layerConfig, map) {
|
240 | 242 | crossOrigin: layerConfig.source.crossOrigin,
|
241 | 243 | }),
|
242 | 244 | });
|
243 |
| - |
| 245 | + case 'pmtiles': |
| 246 | + if (layerConfig.source.pmtilesType === 'raster') { |
| 247 | + return new WebGLTile({ |
| 248 | + name: layerConfig.label, |
| 249 | + title: layerConfig.title || layerConfig.name, |
| 250 | + minZoom: layerConfig.minZoom, |
| 251 | + maxZoom: layerConfig.maxZoom, |
| 252 | + visible: layerConfig.visible, |
| 253 | + opacity: layerConfig.opacity, |
| 254 | + selectable: layerConfig.selectable, |
| 255 | + groups: layerConfig.groups, |
| 256 | + extra: layerConfig.extra, |
| 257 | + order: layerConfig.order, |
| 258 | + splitscreen: layerConfig.splitscreen, |
| 259 | + displayInLayerSwitcher: layerConfig.userVisible, |
| 260 | + source: new PMTilesRasterSource({ |
| 261 | + url: layerConfig.source?.url, |
| 262 | + tileSize: layerConfig.source?.tileSize, |
| 263 | + }) |
| 264 | + }); |
| 265 | + } |
| 266 | + else if (layerConfig.source.pmtilesType === 'vector') { |
| 267 | + return new VectorTileLayer({ |
| 268 | + declutter: true, |
| 269 | + name: layerConfig.label, |
| 270 | + title: layerConfig.title || layerConfig.name, |
| 271 | + minZoom: layerConfig.minZoom, |
| 272 | + maxZoom: layerConfig.maxZoom, |
| 273 | + visible: layerConfig.visible, |
| 274 | + opacity: layerConfig.opacity, |
| 275 | + selectable: layerConfig.selectable, |
| 276 | + groups: layerConfig.groups, |
| 277 | + extra: layerConfig.extra, |
| 278 | + order: layerConfig.order, |
| 279 | + splitscreen: layerConfig.splitscreen, |
| 280 | + displayInLayerSwitcher: layerConfig.userVisible, |
| 281 | + source: new PMTilesVectorSource({ |
| 282 | + url: layerConfig.source?.url, |
| 283 | + }) |
| 284 | + }); |
| 285 | + } |
244 | 286 | /* History ?
|
245 | 287 | new ol.layer.Geoportail({
|
246 | 288 | name: '1970',
|
|
0 commit comments