- PMTiles OpenLayers Example
+ PMTiles OpenLayers Vector Example
@@ -25,7 +25,7 @@
return "pmtiles://" + this._url + "/{z}/{x}/{y}";
}
- tileLoadFunction = (tile,url) => {
+ vectorTileLoadFunction = (tile,url) => {
// the URL construction is done internally by OL, so we need to parse it
// back out here using a hacky regex
const re = new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);
@@ -55,7 +55,7 @@
const source = new OLPMTilesSource("https://pub-9288c68512ed46eca46ddcade307709b.r2.dev/protomaps-sample-datasets/nz-buildings-v3.pmtiles");
- const country = new ol.style.Style({
+ const style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'gray',
width: 1,
@@ -72,9 +72,9 @@
maxZoom: 14, // this could come from the PMTiles header (async)
format: new ol.format.MVT(), // this could come from the PMTiles header (async)
url:source.url(),
- tileLoadFunction: source.tileLoadFunction
+ tileLoadFunction: source.vectorTileLoadFunction
}),
- style: country,
+ style: style,
});
ol.proj.useGeographic();
diff --git a/js/examples/openlayers_raster.html b/js/examples/openlayers_raster.html
new file mode 100644
index 0000000..2a60520
--- /dev/null
+++ b/js/examples/openlayers_raster.html
@@ -0,0 +1,75 @@
+
+
+ PMTiles OpenLayers Raster Example
+
+
+
+
+
+
+
+
+
+
+