Skip to content

Commit f7d07e0

Browse files
authored
V5 0 tiles 4 (#188)
* v5.0: compatibility with basemap tileset v4 [#177] * add `lang` option to frontends for basic multilingual support [#157] * change `theme` option to `flavor` * add @protomaps/basemaps as dependency for flavor definitions * add landcover styling * bump to version v5.0.0 * update CHANGELOG
1 parent 9064eac commit f7d07e0

19 files changed

+320
-688
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 5.0.0
2+
3+
This is a breaking major version change.
4+
5+
* Now only works with the protomaps basemap tileset v4.0 and above. [#177]
6+
* visualize the `landcover` layer in the light and dark flavors.
7+
* replace `theme` option with `flavor` in frontends.
8+
* Add a `lang` option to frontends to change the label language. [#157]
9+
* depend on the `@protomaps/basemaps` package for flavor definitions.
10+
111
# 4.1.0
212
* clarify types of `LeafletLayerOptions` and `leafletLayer` via @jwasilgeo [#179]
313

benchmark/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
88
<script src="pixelmatch.js"></script>
9-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
9+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
1010
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1111
<style>
1212
html {

examples/comparison.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" crossorigin="anonymous">
1010
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js" crossorigin="anonymous"></script>
1111
<script src="https://unpkg.com/@maplibre/[email protected]/leaflet-maplibre-gl.js"></script>
12-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
12+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
1313
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1414
<style>
1515
#parent {
@@ -31,7 +31,7 @@
3131
const map = L.map('leaflet');
3232
let hash = new L.Hash(map)
3333
if (!window.location.hash) map.setView(new L.LatLng(0,0),0)
34-
var layer = protomapsL.leafletLayer({url:'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f',theme:theme})
34+
var layer = protomapsL.leafletLayer({url:'https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f',theme:theme})
3535
layer.addTo(map)
3636

3737
const map2 = L.map('map2')
@@ -42,7 +42,7 @@
4242
sources:{
4343
protomaps:{
4444
type:"vector",
45-
tiles:['https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f'],
45+
tiles:['https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f'],
4646
maxzoom: 15
4747
}
4848
},

examples/fonts.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
66
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
77
<script src="https://unpkg.com/[email protected]/leaflet-hash.js"></script>
8-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
8+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
99
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1010

1111
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&family=Work+Sans:[email protected]&family=Petrona:[email protected]&family=Raleway:[email protected]" rel="stylesheet">
@@ -91,7 +91,7 @@
9191
}
9292

9393
let layer = protomapsL.leafletLayer({
94-
url:'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f',
94+
url:'https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f',
9595
paintRules:paintRules,
9696
labelRules:labelRulesWithFont("sans-serif"),
9797
tasks:[document.fonts.load("12px Work Sans"),document.fonts.load("12px Manrope"),document.fonts.load("12px Inter"),document.fonts.load("12px Petrona"),document.fonts.load("12px Raleway")]

examples/inset.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<head>
33
<meta charset="utf-8" />
44
<meta name="viewport" content="width=device-width, initial-scale=1">
5-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
5+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
66
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
77
<style>
88
#map {
@@ -23,7 +23,7 @@
2323
canvas.height = 600 * dpr
2424
let ctx = canvas.getContext('2d')
2525
ctx.scale(dpr,dpr)
26-
let map = new protomapsL.Static({url:"https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f", theme: "light"})
26+
let map = new protomapsL.Static({url:"https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f", theme: "light"})
2727
let {project} = await map.drawContext(ctx,800,600,{y:22.1777,x:114.1635},10)
2828
let highlight = project({y:22.2777,x:114.1635})
2929
ctx.globalAlpha = 0.2

examples/labels.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
66
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
77
<script src="https://unpkg.com/[email protected]/leaflet-hash.js"></script>
8-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
8+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
99
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1010
<style>
1111
body, #map {
@@ -41,7 +41,7 @@
4141
}
4242
]
4343

44-
let labels = protomapsL.leafletLayer({url:'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f',paintRules:[],labelRules:labelRules})
44+
let labels = protomapsL.leafletLayer({url:'https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f',paintRules:[],labelRules:labelRules})
4545
labels.addTo(map)
4646
</script>
4747
</body>

examples/leaflet.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
66
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
77
<script src="https://unpkg.com/[email protected]/leaflet-hash.js"></script>
8-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
8+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
99
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1010
<style>
1111
body, #map {
@@ -20,7 +20,7 @@
2020
const map = L.map('map')
2121
let hash = new L.Hash(map)
2222
if (!window.location.hash) map.setView(new L.LatLng(0,0),0)
23-
var layer = protomapsL.leafletLayer({url:'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f',theme:'light'})
23+
var layer = protomapsL.leafletLayer({url:'https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f',flavor:'light', lang: "en"})
2424
layer.addTo(map)
2525

2626
map.on("click", (ev) => {

examples/multi_source.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
66
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
77
<script src="https://unpkg.com/[email protected]/leaflet-hash.js"></script>
8-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
8+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
99
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1010
<style>
1111
body, #map {
@@ -19,8 +19,8 @@
1919
<canvas id="map"></canvas>
2020
<script>
2121
let sources = {
22-
'':{url:'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f'},
23-
'source2':{url:'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=1003762824b9687f',maxDataZoom:10}
22+
'':{url:'https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f'},
23+
'source2':{url:'https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.mvt?key=1003762824b9687f',maxDataZoom:10}
2424
}
2525

2626
let paintRules = [

examples/pmtiles.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
66
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
7-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
7+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
88
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
99
<style>
1010
body, #map {
@@ -17,7 +17,7 @@
1717
<div id="map"></div>
1818
<script>
1919
const map = L.map('map')
20-
var layer = protomapsL.leafletLayer({url:'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles',theme:'black'})
20+
var layer = protomapsL.leafletLayer({url:'https://data.source.coop/protomaps/openstreetmap/v4.pmtiles',theme:'black'})
2121
map.setView(new L.LatLng(0,0),0)
2222
layer.addTo(map)
2323
</script>

examples/pmtiles_headers.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
66
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
77
<script src="https://unpkg.com/[email protected]/dist/pmtiles.js"></script>
8-
<script src="https://unpkg.com/protomaps-leaflet@4.1.1/dist/protomaps-leaflet.js"></script>
8+
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
99
<!-- <script src="../dist/protomaps-leaflet.js"></script> -->
1010
<style>
1111
body, #map {
@@ -19,7 +19,7 @@
1919
<script>
2020
const map = L.map('map')
2121

22-
const source = new pmtiles.FetchSource("https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles", {"x-custom-header":"value"});
22+
const source = new pmtiles.FetchSource("https://data.source.coop/protomaps/openstreetmap/v4.pmtiles", {"x-custom-header":"value"});
2323

2424
const p = new pmtiles.PMTiles(source)
2525
var layer = protomapsL.leafletLayer({url:p,theme:'black'})

0 commit comments

Comments
 (0)