mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 19:01:08 +00:00
js v2.0.0: rename protocol.tileFunc -> tile, CHANGELOG, README
This commit is contained in:
@@ -1,3 +1,24 @@
|
|||||||
|
2.0.0
|
||||||
|
|
||||||
|
* Major version bump, changing the JS API.
|
||||||
|
* Support for PMTiles spec version 3 archives.
|
||||||
|
* Backwards compatibility with v2 archives.
|
||||||
|
* Leaflet and MapLibre adapters support tile cancellation, improving performance significantly.
|
||||||
|
* ETag and Retry support for archives that are updated in-place.
|
||||||
|
* Cache-Control and Expires header support for MapLibre.
|
||||||
|
|
||||||
|
Clearer API names:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const p = new pmtiles.PMTiles('example.pmtiles')
|
||||||
|
pmtiles.leafletRasterLayer(p).addTo(map)
|
||||||
|
```
|
||||||
|
```js
|
||||||
|
let protocol = new pmtiles.Protocol();
|
||||||
|
maplibregl.addProtocol("pmtiles",protocol.tile);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
1.0.0
|
1.0.0
|
||||||
|
|
||||||
* Breaking change, introducing new TypeScript module with more clearly defined interfaces.
|
* Breaking change, introducing new TypeScript module with more clearly defined interfaces.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Example of a raster PMTiles archive displayed in Leaflet:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const p = new pmtiles.PMTiles('example.pmtiles')
|
const p = new pmtiles.PMTiles('example.pmtiles')
|
||||||
pmtiles.leafletLayer(p,{attribution:'© <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}).addTo(map)
|
pmtiles.leafletRasterLayer(p,{attribution:'© <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}).addTo(map)
|
||||||
````
|
````
|
||||||
|
|
||||||
### Vector tileset
|
### Vector tileset
|
||||||
@@ -22,8 +22,8 @@ pmtiles.leafletLayer(p,{attribution:'© <a href="https://openstreetmap.org">Open
|
|||||||
Example of a PMTiles archive displayed in MapLibre GL JS:
|
Example of a PMTiles archive displayed in MapLibre GL JS:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
let cache = new pmtiles.ProtocolCache();
|
let protocol = new pmtiles.Protocol();
|
||||||
maplibregl.addProtocol("pmtiles",cache.protocol);
|
maplibregl.addProtocol("pmtiles",protocol.tileFunc);
|
||||||
var style = {
|
var style = {
|
||||||
"version": 8,
|
"version": 8,
|
||||||
"sources": {
|
"sources": {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export class Protocol {
|
|||||||
return this.tiles.get(url);
|
return this.tiles.get(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
tileFunc = (params: any, callback: any) => {
|
tile = (params: any, callback: any) => {
|
||||||
const re = new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);
|
const re = new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);
|
||||||
const result = params.url.match(re);
|
const result = params.url.match(re);
|
||||||
const pmtiles_url = result[1];
|
const pmtiles_url = result[1];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pmtiles",
|
"name": "pmtiles",
|
||||||
"version": "1.1.0",
|
"version": "2.0.0",
|
||||||
"description": "PMTiles archive decoder for browsers",
|
"description": "PMTiles archive decoder for browsers",
|
||||||
"main": "dist/index.cjs",
|
"main": "dist/index.cjs",
|
||||||
"module": "dist/index.mjs",
|
"module": "dist/index.mjs",
|
||||||
|
|||||||
Reference in New Issue
Block a user