Skip to content

Commit

Permalink
Merge pull request #203 from protomaps/js-2-9
Browse files Browse the repository at this point in the history
js 2.9; pass header bounds through maplibre protocol
  • Loading branch information
bdon authored Jun 22, 2023
2 parents 56f5a7c + 181c9ef commit 6e07acd
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2.9.0

* Recognize AVIF TileType
* MapLibre adapter internally passes bounds from PMTiles header

2.8.0

* Polyfill `DecompressionStream` using 101arrowz/compression-streams-polyfill
Expand Down
3 changes: 1 addition & 2 deletions js/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,14 @@ export class Protocol {
this.tiles.set(pmtiles_url, instance);
}

// TODO: create vector_layers if present to return valid TileJSON

instance
.getHeader()
.then((h) => {
const tilejson = {
tiles: [params.url + "/{z}/{x}/{y}"],
minzoom: h.minZoom,
maxzoom: h.maxZoom,
bounds: [h.minLon, h.minLat, h.maxLon, h.maxLat],
};
callback(null, tilejson, null, null);
})
Expand Down
2 changes: 1 addition & 1 deletion js/examples/leaflet.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/pmtiles@2.8.0/dist/index.js"></script>
<script src="https://unpkg.com/pmtiles@2.9.0/dist/index.js"></script>
<style>
body, #map {
height:100vh;
Expand Down
2 changes: 1 addition & 1 deletion js/examples/maplibre.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" crossorigin="anonymous">
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/pmtiles@2.8.0/dist/index.js"></script>
<script src="https://unpkg.com/pmtiles@2.9.0/dist/index.js"></script>
<style>
body {
margin: 0;
Expand Down
2 changes: 1 addition & 1 deletion js/examples/maplibre_raster_dem.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" crossorigin="anonymous">
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/pmtiles@2.8.0/dist/index.js"></script>
<script src="https://unpkg.com/pmtiles@2.9.0/dist/index.js"></script>
<style>
body {
margin: 0;
Expand Down
4 changes: 2 additions & 2 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pmtiles",
"version": "2.8.0",
"version": "2.9.0",
"description": "PMTiles archive decoder for browsers",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand Down

0 comments on commit 6e07acd

Please sign in to comment.