forked from bdon/protomaps-workshop-sotmus24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslides.html
353 lines (353 loc) · 12.1 KB
/
slides.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<html lang="en">
<style>
a {
text-decoration: underline !important;
}
</style>
<head>
<meta charset="utf-8">
<title>SOTM US 2024 | Protomaps from the Ground Up</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/5.1.0/reveal.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/5.1.0/plugin/highlight/monokai.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/5.1.0/theme/serif.css" id="theme">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Workshop</h1>
<h2>Protomaps from the Ground Up</h2>
<p>repo and slides: <br/> <a target="_blank" href="https://github.com/bdon/protomaps-workshop-sotmus24">github.com/bdon/protomaps-workshop-sotmus24</a>
</section>
<section>
<p>Protomaps is a solution for interactive web maps, <b>100% open source and under your own control.</b></p>
</section>
<section>
<p>What is the <b>status quo?</b></p>
</section>
<section>
<img class="r-stretch" src="images/osmcarto.png"></img>
<ul>
<li>difficult to reproduce</li>
<li>raster-based image tiles</li>
<li>does not show all / customized OSM data</li>
</ul>
</section>
<section>
<h3>Hosted OSM Tile APIs</h3>
<ul>
<li>Commercial B2B SaaS offerings</li>
<li>Impossible to reproduce</li>
<li>Unclear relation to OSM data (filtering, timeliness)</li>
</ul>
</section>
<section>
<h3>Build-your-own Tiles</h3>
<ul>
<li>Tile server complex to set up and administer</li>
<li>Z/X/Y tiles: millions of files difficult to upload/download</li>
</ul>
</section>
<section>
<h3>PMTiles</h3>
<ul>
<li><a href="http://github.com/protomaps/pmtiles" target="_blank">Single file format</a> for millions+ of tiles</li>
<li>"Cloud-native" or "serverless" - Accessed directly in the browser via <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests">HTTP Range Requests</a></li>
</ul>
</section>
<section>
<h3>Protomaps project components</h3>
<ul>
<li><a target="_blank" href="https://github.com/protomaps/PMTiles/blob/main/spec/v3/spec.md">PMTiles</a> open tile archive format</li>
<li><a target="_blank" href="https://github.com/protomaps/pmtiles">Tools and libraries</a> (<a href="https://github.com/protomaps/go-pmtiles">pmtiles cli</a>, JavaScript...)</li>
<li>OSM tileset</li>
</ul>
</section>
<section>
<h2>Example Use Cases</h2>
</section>
<section>
<img class="r-stretch" src="images/historicdetroit.png"></img>
<p><a target="_blank" href="https://historicdetroit.org">Historic Detroit</a></p>
<p>by Dan Austin, Helmut Ziewers, Matt Hampel</p>
</section>
<section>
<img class="r-stretch" src="images/bridgewatch.png"></img>
<p><a target="_blank" href="https://bridge.watch/map">Bridge.Watch</a></p>
<p>by Maryanne Watcher</p>
</section>
<section>
<img class="r-stretch" src="images/seoulbuildingexplorer.png"></img>
<p><a target="_blank" href="https://hanbyul-here.github.io/seoul-building-explorer-2024">Seoul Building Explorer</a></p>
<p>by Hanbyul Jo</p>
</section>
<section>
<img class="r-stretch" src="images/planthardiness.png"></img>
<p><a target="_blank" href="https://apps.npr.org/plant-hardiness-garden-map">Plant Hardiness Map</a></p>
<p>by NPR</p>
</section>
<section>
<h3>PMTiles is made for <b>web-based viewing of large, mostly static</b> datasets.</h3>
</section>
<section>
<p>Not big? use GeoJSON</p>
<img class="r-stretch" src="images/geojsonio.png"></img>
</section>
<section>
<p>Not static? use PostGIS.</p>
<img src="images/postgis.png"></img>
</section>
<section>
Not on the web? use QGIS.
<img src="images/qgis.png"></img>
</section>
<section>
<h3>Workshop: What we're making today</h3>
<img class="r-stretch" src="images/part3.png"></img>
<p><a target="_blank" href="part3/">(live demo)</a></p>
</section>
<section>
<h3>What this is</h3>
<ul>
<li>100% static site</li>
<li>Every major part is hosted under our own control</li>
<li>OSM data liveness and customization</li>
</ul>
</section>
<section>
<p>Fork this repo!</p>
<p><a target="_blank" href="https://github.com/bdon/protomaps-workshop-sotmus24">github.com/bdon/protomaps-workshop-sotmus24</a></p>
<ul>
<li>Part 1: displaying a Great Outdoors dataset</li>
<li>Part 2: add a terrain PMTiles</li>
<li>Part 3: add an OSM basemap</li>
</ul>
</section>
<section>
<h3>What you need</h3>
<ul>
<li><a target="_blank" href="https://github.com">Git and GitHub account</a></li>
<li><a target="_blank" href="https://www.npmjs.com/package/http-server">local HTTP server</a></li>
<li><a target="_blank" href="https://github.com/protomaps/go-pmtiles">pmtiles CLI (go-pmtiles)</a></li>
</ul>
</section>
<section>
<h3>Highly recommended</h3>
<ul>
<li><a target="_blank" href="https://github.com/felt/tippecanoe">tippecanoe</a></li>
<li><a target="_blank" href="https://osmcode.org/osmium-tool/">osmium</a></li>
</ul>
</section>
<section>
<h3>Part 1</h3>
<img class="r-stretch" src="images/part1.png"></img>
<p><a target="_blank" href="part1/">(live demo)</a></p>
</section>
<section>
<h3>Acquiring fresh Utah data</h3>
<img class="r-stretch" src="images/protomapsextract.png"></img>
<ul>
<a target="_blank" href="https://download.geofabrik.de/north-america/us/utah.html">Geofabrik Downloads (Daily)</a>
<a target="_blank" href="https://app.protomaps.com">app.protomaps.com (Minutely)</a>
</ul>
</section>
<section>
Filtering the Great Outdoors from the complete OSM extract
<pre>
osmium tags-filter -o paths.osm.pbf utah.osm.pbf w/highway=path
</pre>
</section>
<section>
Generating PMTiles archive
<pre>
osmium export paths.osm.pbf -f geojsonseq |
tippecanoe -o utah_highway_path.pmtiles -f
</pre>
</section>
<section>
<h3>Drag-and-drop inspect</h3>
<a target="_blank" href="https://protomaps.github.io/PMTiles/">PMTiles viewer</a>
</section>
<section>
<h3>Displaying in MapLibre</h3>
<img class="r-stretch" src="images/maplibre.png"></img>
<ul>
<li>WebGL vector tile, raster and terrain renderer</li>
<li>FOSS fork of Mapbox GL JS 1.0</li>
</ul>
</section>
<section>
<h3>Aside: MapLibre vs. Leaflet</h3>
<ul>
<li><a target="_blank" href="https://leafletjs.org">Leaflet</a>: less code weight, no map rotation or fractional zooms</li>
<li><a target="_blank" href="github.com/protomaps/protomaps-leaflet">protomaps-leaflet</a> plugin for vector rendering (we'll skip)</li>
<li>MapLibre recommended for greenfield projects</li>
</ul>
</section>
<section>
<h3>MapLibre PMTiles plugin</h3>
<pre><code data-noescape>
let protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
</code></pre>
</section>
<section>
<h3>MapLibre PMTiles source</h3>
<pre><code data-noescape>
sources: {
trails: {
type: "vector",
url: "pmtiles://../utah_highway_path.pmtiles",
attribution: '© <a target="_blank" href="https://openstreetmap.org">OpenStreetMap contributors</a>'
}
},
</code></pre>
</section>
<section>
<h3>Let's publish!</h3>
<img class="r-stretch" src="images/githubpages.png"></img>
</section>
<section>
<h3>Customization</h3>
<ul>
<li>Change the color of trail paths</li>
<li>Label the trails differently (trail_visibility)?</li>
<li>Use a different area</li>
<li>Use a different tag filter</li>
</ul>
</section>
<section>
<h3>Part 2</h3>
<p>What's our map missing?</p>
<img class="r-stretch" src="images/part2.png"></img>
<p><a target="_blank" href="part2/">(live demo)</a></p>
</section>
<section>
<img class="r-stretch" src="images/joerd.png"></img>
<ul>
<li>PMTiles is not just for raster data!</li>
<li><a target="_blank" href="https://github.com/tilezen/joerd">Mapzen Joerd</a> project</li>
<li>RGB Terrarium format for dynamic client-side hillshading</li>
</ul>
</section>
<section>
<h3>Using PMTiles CLI</h3>
<p>I pre-packaged a PMTiles of Joerd from zooms 0-12</p>
<pre>https://r2-public.protomaps.com/protomaps-sample-datasets/terrarium-z12.pmtiles</pre>
<p>try using <pre>pmtiles show</pre></p>
</section>
<section>
<h3>Using PMTiles extract</h3>
<pre>pmtiles extract \
--bbox=-114.111749,36.937896,-108.97866,42.098695 \
https://r2-public.protomaps.com/protomaps-sample-datasets/terrarium-z12.pmtiles \
utah_terrarium.pmtiles</pre>
</section>
<section>
<h3>MapLibre PMTiles terrain</h3>
<pre><code data-noescape>
terrain: {
type: "raster-dem",
url: "pmtiles://../utah_terrarium.pmtiles",
attribution: '© Joerd',
encoding: 'terrarium'
}
</code></pre>
</section>
<section>
<h3>Customization</h3>
<ul>
<li>Change the area</li>
<li>Change the <a target="_blank" href="https://maplibre.org/maplibre-style-spec/layers/#hillshade">hillshade angle</a></li>
</ul>
</section>
<section>
<h3>Part 3</h3>
<p>What else is missing?</p>
<img class="r-stretch" src="images/part3.png"></img>
<p><a target="_blank" href="part3/">(live demo)</a></p>
</section>
<section>
<h3>Basemap vs. Overlay distinction</h3>
<ul>
<li>overlay = application specific data and interactivity</li>
<li>basemap = necessary context (labels...), eveything else in OSM</li>
</ul>
</section>
<section>
<h3>Protomaps Basemap</h3>
<ul>
<li>vector tiles, zooms 0-15, OSM + <a target="_blank" href="http://naturalearthdata.com">Natural Earth</a></li>
<li>5 themes (light, dark, white, grayscale, black)</li>
<li>View at <a target="_blank" href="https://maps.protomaps.com">maps.protomaps.com</a></li>
</ul>
</section>
<section>
<img class="r-stretch" src="images/builds.png"></img>
<p>Daily build incorporates fresh OSM data</p>
</section>
<section>
<h3>Using PMTiles CLI</h3>
<pre>pmtiles show https://builds.protomaps.com/20240607.pmtiles</pre>
</section>
<section>
<h3>Using PMTiles extract</h3>
<pre>pmtiles extract \
--bbox=-114.111749,36.937896,-108.97866,42.098695 \
https://builds.protomaps.com/20240607.pmtiles \
utah_basemap.pmtiles</pre>
</section>
<section>
<pre><code data-noescape>
basemap: {
type: "vector",
url: "pmtiles://../utah_basemap.pmtiles",
attribution: '© <a href="https://openstreetmap.org">OpenStreetMap contributors</a>'
}
</code></pre>
</section>
<section>
<h3>MapLibre style npm package</h3>
<pre><code data-noescape>
const baselayers = protomaps_themes_base.default("basemap", "light");
...
sprite: "https://protomaps.github.io/basemaps-assets/sprites/v3/light",
...
layers: [
...baselayers,
...
</code></pre>
</section>
<section>
<h3>Customization</h3>
<ul>
<li>Change to another premade theme</li>
<li><i>Use your own color scheme</i> (coming soon!)</li>
<li><i>Change the language</i> (coming soon!)</li>
<li>Edit OSM and get a new daily build tomorrow!</li>
</ul>
</section>
<section>
<h3>Next Steps</h3>
<ul>
<li>Modify styles/tiles (java): <a target="_blank" href="https://github.com/protomaps/basemaps">protomaps/basemaps repo</a></li>
<li><a href="https://docs.protomaps.com/pmtiles/cloud-storage" target="_blank">Static storage platforms</a></li>
<li><a href="https://docs.protomaps.com/deploy/">CDN integration for high-volume deployments</a></li>
<li>Q&A</li>
<li>OSMUS Slack #protomaps</li>
</ul>
</section>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/5.1.0/reveal.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/5.1.0/plugin/highlight/highlight.js"></script>
<script>
Reveal.initialize({
history: true,
transition: 'linear',
plugins: [RevealHighlight]
});
</script>
</body>
</html>