PMTilesVectorSource only works with OL 9, not with the current versions.
<script src="https://cdn.jsdelivr.net/npm/ol@v10.8.0/dist/ol.js"></script>
<script src="https://unpkg.com/ol-pmtiles@2.0.2/dist/olpmtiles.js"></script>
Example from: https://github.com/protomaps/PMTiles/tree/main/openlayers
const vectorLayer = new ol.layer.VectorTile({
declutter: true,
source: new olpmtiles.PMTilesVectorSource({
url: "https://r2-public.protomaps.com/protomaps-sample-datasets/nz-buildings-v3.pmtiles",
attributions: ["© Land Information New Zealand"],
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: "gray",
width: 1,
}),
fill: new ol.style.Fill({
color: "rgba(20,20,20,0.9)",
}),
}),
});
map.addLayer(vectorLayer);
util.js:29 Uncaught TypeError: Cannot read properties of undefined (reading 'ol_uid')
PMTilesVectorSource only works with OL 9, not with the current versions.
<script src="https://cdn.jsdelivr.net/npm/ol@v10.8.0/dist/ol.js"></script> <script src="https://unpkg.com/ol-pmtiles@2.0.2/dist/olpmtiles.js"></script>Example from: https://github.com/protomaps/PMTiles/tree/main/openlayers
const vectorLayer = new ol.layer.VectorTile({
declutter: true,
source: new olpmtiles.PMTilesVectorSource({
url: "https://r2-public.protomaps.com/protomaps-sample-datasets/nz-buildings-v3.pmtiles",
attributions: ["© Land Information New Zealand"],
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: "gray",
width: 1,
}),
fill: new ol.style.Fill({
color: "rgba(20,20,20,0.9)",
}),
}),
});
map.addLayer(vectorLayer);
util.js:29 Uncaught TypeError: Cannot read properties of undefined (reading 'ol_uid')