ol-pmtiles 0.4.0 (#374)

* fix double ol source tile load events [#373]
* bump pmtiles dependency to 3.x
* bump examples to ol 9.x
* fix package.json publint
This commit is contained in:
Brandon Liu
2024-03-06 15:45:27 +08:00
committed by GitHub
parent 43133f40c7
commit 46de0b076d
6 changed files with 32 additions and 18 deletions

View File

@@ -2,9 +2,9 @@
<head> <head>
<title>PMTiles OpenLayers Raster Example</title> <title>PMTiles OpenLayers Raster Example</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<script src="https://cdn.jsdelivr.net/npm/ol@v7.3.0/dist/ol.js"></script> <script src="https://cdn.jsdelivr.net/npm/ol@v9.0.0/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v7.3.0/ol.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v9.0.0/ol.css">
<script src="https://unpkg.com/ol-pmtiles@0.3.0/dist/olpmtiles.js"></script> <script src="https://unpkg.com/ol-pmtiles@0.4.0/dist/olpmtiles.js"></script>
<style> <style>
body, #map { body, #map {
height:100vh; height:100vh;

View File

@@ -2,9 +2,9 @@
<head> <head>
<title>PMTiles OpenLayers Vector Example</title> <title>PMTiles OpenLayers Vector Example</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<script src="https://cdn.jsdelivr.net/npm/ol@v7.3.0/dist/ol.js"></script> <script src="https://cdn.jsdelivr.net/npm/ol@v9.0.0/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v7.3.0/ol.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v9.0.0/ol.css">
<script src="https://unpkg.com/ol-pmtiles@0.3.0/dist/olpmtiles.js"></script> <script src="https://unpkg.com/ol-pmtiles@0.4.0/dist/olpmtiles.js"></script>
<style> <style>
body, #map { body, #map {
height:100vh; height:100vh;

View File

@@ -9,7 +9,7 @@
"version": "0.3.0", "version": "0.3.0",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"dependencies": { "dependencies": {
"pmtiles": "2.11.0" "pmtiles": "^3.0.4"
}, },
"devDependencies": { "devDependencies": {
"esbuild": "^0.15.11" "esbuild": "^0.15.11"
@@ -99,6 +99,19 @@
"integrity": "sha512-AhVAm6SQ+zgxIiOzwVdUcDmKlu/qU39FiYD2UD6kQQaVenrn0dGZewIghWAENGQsvC+1avLCuT+T2/3Gsp/W3w==", "integrity": "sha512-AhVAm6SQ+zgxIiOzwVdUcDmKlu/qU39FiYD2UD6kQQaVenrn0dGZewIghWAENGQsvC+1avLCuT+T2/3Gsp/W3w==",
"peer": true "peer": true
}, },
"node_modules/@types/geojson": {
"version": "7946.0.14",
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz",
"integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg=="
},
"node_modules/@types/leaflet": {
"version": "1.9.8",
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.8.tgz",
"integrity": "sha512-EXdsL4EhoUtGm2GC2ZYtXn+Fzc6pluVgagvo2VC1RHWToLGlTRwVYoDpqS/7QXa01rmDyBjJk3Catpf60VMkwg==",
"dependencies": {
"@types/geojson": "*"
}
},
"node_modules/csscolorparser": { "node_modules/csscolorparser": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz",
@@ -591,10 +604,11 @@
} }
}, },
"node_modules/pmtiles": { "node_modules/pmtiles": {
"version": "2.11.0", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/pmtiles/-/pmtiles-2.11.0.tgz", "resolved": "https://registry.npmjs.org/pmtiles/-/pmtiles-3.0.4.tgz",
"integrity": "sha512-dU9SzzaqmCGpdEuTnIba6bDHT6j09ZJFIXxwGpvkiEnce3ZnBB1VKt6+EOmJGueriweaZLAMTUmKVElU2CBe0g==", "integrity": "sha512-dqxfYM/b0Y59JEk55piird5gqcRwq9o3yLBV2/l7ecfMPbCt+ccVxtPf5Ox8h/amCyRov+WgnbLLFGp8D5E8Gw==",
"dependencies": { "dependencies": {
"@types/leaflet": "^1.9.8",
"fflate": "^0.8.0" "fflate": "^0.8.0"
} }
}, },

View File

@@ -1,12 +1,14 @@
{ {
"name": "ol-pmtiles", "name": "ol-pmtiles",
"version": "0.3.0", "version": "0.4.0",
"description": "PMTiles sources for OpenLayers", "description": "PMTiles sources for OpenLayers",
"type": "module", "type": "module",
"main": "src/index.js", "exports": [
"./src/index.js"
],
"files": [ "files": [
"dist/olpmtiles.js", "./dist/olpmtiles.js",
"src/index.js" "./src/index.js"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
@@ -26,12 +28,12 @@
"prettier-check": "prettier --check *.js" "prettier-check": "prettier --check *.js"
}, },
"dependencies": { "dependencies": {
"pmtiles": "2.11.0" "pmtiles": "^3.0.4"
}, },
"devDependencies": { "devDependencies": {
"esbuild": "^0.15.11" "esbuild": "^0.15.11"
}, },
"peerDependencies": { "peerDependencies": {
"ol": ">=7.3.0" "ol": ">=9.0.0"
} }
} }

View File

@@ -53,7 +53,6 @@ export class PMTilesVectorSource extends VectorTile {
const y = +result[4]; const y = +result[4];
tile.setLoader((extent, resolution, projection) => { tile.setLoader((extent, resolution, projection) => {
tile.setState(TileState.LOADING);
this.pmtiles_ this.pmtiles_
.getZxy(z, x, y) .getZxy(z, x, y)
.then((tile_result) => { .then((tile_result) => {

View File

@@ -59,7 +59,6 @@ export class PMTilesVectorSource extends ol.source.VectorTile {
const y = +result[4]; const y = +result[4];
tile.setLoader((extent, resolution, projection) => { tile.setLoader((extent, resolution, projection) => {
tile.setState(1);
this.pmtiles_ this.pmtiles_
.getZxy(z, x, y) .getZxy(z, x, y)
.then((tile_result) => { .then((tile_result) => {