forked from maptimeBoston/web-maps-101
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
451 lines (374 loc) · 13.2 KB
/
index.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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>#webmaptime</title>
<link target="_blank" href='http://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'>
<style>
/*
SLIDE STYLES:
All slides are assumed to contain one 'p' element, one 'img' element, or one of each.
<div class="slide">
-- Default style. If no image, text is centered. If image present, it is centered and text is at the top.
-- Arbitrary content could go here too (e.g. I used a couple of iframes), but default behavior will mess with any p or img elements.
<div class="slide image_full">
-- Full 1024x768 img, somewhat faded to black and with bold white text (p) centered on top.
<div class="slide image_bottom">
-- Mostly like default except that image appears at the bottom. (Basically just to give more room for longer text).
Can make additional class styles for p elements and such if you need different text sizes, colors, etc.
(e.g. there is a p.title style with a bigger font)
img elements themselves are not displayed; rather, their src attributes are applied as div backgrounds. This is to make centering easier, basically.
*/
html, body{
margin: 0;
font: 20px/24px "PT Sans", sans-serif;
background-color: #EAB815;
}
.slide, .slide div{
position: absolute;
top: 0;
left: 0;
width: 1024px;
height: 768px;
background-position: center center;
background-repeat: no-repeat;
}
.slide{
background-color: #EAB815;
}
.slide.image_bottom{
background-position: center bottom;
}
.slide p{
position: absolute;
font-size: 64px;
line-height: 72px;
font-weight: bold;
text-align: center;
margin: 15px 1% 0 1%;
width: 98%;
}
.slide ul{
top: 50px;
left: 300px;
position: absolute;
font-size: 64px;
line-height: 72px;
font-weight: bold;
text-align: left;
margin: 0;
}
.slide img{
display: none;
}
.slide.image_full{
background-color: black;
}
.slide.image_full div{
opacity: .5;
}
.slide.image_full p{
color: white;
text-shadow:0px 0px 10px #000000;
}
.slide.image_full.repeat div{
background-position: 0 0;
background-repeat: repeat;
}
.slide p.title{
font-size: 120px;
}
a{
color: #669;
text-decoration: none;
}
a:hover{
text-decoration: underline;
}
a.citation{
position: absolute;
bottom: 5px;
right: 5px;
color: #000;
background-color: rgba(255,255,255,.75);
}
.code{
font-family: 'Courier New';
}
</style>
</head>
<body>
<div class="slide">
<p class="title">#webmaptime</p>
<a class="citation" target="_blank" href="http://github.com/maptimeboston">Mike Foster and Andy Woodruff for Maptime Boston</a>
</div>
<div class="slide image_full">
<img src="images/anatomy.jpg"/>
<p>FIRST: Thanks to Alan McConchie, Beth Schechter, and the Maptime team for much of this material!</p>
<a class="citation" target="_blank" href="https://github.com/maptime/anatomy-of-a-web-map">Anatomy of a Web Map</a>
</div>
<div class="slide">
<p>Follow along! <a target="_blank" href="http://maptime-ams.github.io/web-maps-101" style="font-size:36px"><br/>http://maptime-ams.github.io/web-maps-101</a></p>
</div>
<div class="slide image_full">
<img src="images/web.jpg"/>
<p>What is a web map?</p>
</div>
<div class="slide">
<p>"Web map" often implies a map that is not simply <em>on</em> the web, but rather one that is <em>powered by</em> the web.</p>
</div>
<div class="slide">
<p>A <em>digital map</em> is on a computer, but may not be accessible by internet, and is relatively static if it is.</p>
</div>
<div class="slide">
<img src="images/bus_digital.jpg"/>
<a class="citation" target="_blank" href="http://bostonography.com/2013/live-mbta-bus-speeds/">bostonography</a>
</div>
<div class="slide">
<p>A <em>web map</em> depends on the internet. It is usually interactive and not always self-contained.</p>
</div>
<div class="slide">
<iframe width="100%" height="95%" frameborder="0" src="http://bostonography.com/bus"></iframe>
<a class="citation" target="_blank" href="http://bostonography.com/bus">bostonography</a>
</div>
<div class="slide">
<img src="images/geocoding_mapquest.gif"/>
<p>MapQuest ruled the early days of web maps</p>
</div>
<div class="slide">
<img src="images/gmaps_xmas.jpg"/>
<p>Enter Google, 2005</p>
</div>
<div class="slide image_bottom">
<p>Google Maps pioneered what is now sometimes called a "slippy map"</p>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d94411.73947848764!2d-71.05715705!3d42.31337345!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89e3652d0d3d311b%3A0x787cbf240162e8a0!2sBoston%2C+MA!5e0!3m2!1sen!2sus!4v1403529313730" width="1024" height="500" frameborder="0" style="border:0; position: absolute; bottom: 0"></iframe>
</div>
<div class="slide image_full repeat">
<img src="images/banana.gif"/>
<p>So how does a "slippy map" work?</p>
</div>
<div class="slide image_full">
<img src="images/mapquest_tiles2.png"/>
<p>A "slippy map" is usually made of tiles.</p>
</div>
<div class="slide image_full">
<img src="images/tile_loading.gif"/>
<p>Tiling chops the map into pieces to quickly load only the part of the map in view.</p>
<a class="citation" target="_blank" href="http://maps.stamen.com/">maps.stamen.com</a>
</div>
<div class="slide image_bottom">
<img src="images/tile_pixels.png"/>
<p>Tiles are usually pre-rendered raster images, although vector tiles are on the rise.</p>
</div>
<div class="slide image_full">
<img src="images/various_tiles.jpg"/>
<p>All (most) tiles are created equal.</p>
<a class="citation" target="_blank" href="http://www.openwhatevermap.org/">openwhatevermap.org</a>
</div>
<div class="slide">
<img src="images/tiles.gif"/>
<p>256 x 256 pixels.<br/>
Standardized locations.<br/>
20ish zoom levels.</p>
</div>
<div class="slide">
<p>zoom, x, y<br/><br/>
e.g. .../14/4955/6059.png</p>
</div>
<div class="slide">
<img src="images/zoom2.jpg"/>
</div>
<div class="slide">
<img src="images/zoom3.jpg"/>
</div>
<div class="slide">
<p>Number of tiles at zoom level <em>z</em>:<br/>
2<sup>z</sup> x 2<sup>z</sup> = 4<sup>z</sup></p>
</div>
<div class="slide">
<p>At the resolution of my computer, a world map at zoom 21 would be nearly 78 miles square!</p>
<a class="citation" target="_blank" href="http://msdn.microsoft.com/en-us/library/bb259689.aspx">Bing Maps Tile System</a>
</div>
<div class="slide">
<iframe width="100%" height="95%" frameborder="0" src="tiles.html"></iframe>
</div>
<div class="slide image_full">
<img src="images/mercator1569.jpg"/>
<p>Tiled web maps use the Mercator projection.</p>
<a class="citation" target="_blank" href="http://en.wikipedia.org/wiki/Mercator_projection#mediaviewer/File:Mercator_1569.png">Wikipedia</a>
</div>
<div class="slide">
<p>The math is simple!*<br/><br/>
x = λ<br/>
y = ln(tan φ + sec φ)<br/>
where λ is longitude, φ is latitude
</p>
<a class="citation" href="http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf" target="_blank">*kind of. 'Web Mercator' is more complicated, but you can still do many things with the basic formula.</a>
</div>
<div class="slide image_bottom">
<img src="images/mercator_rhumb.jpg"/>
<p>Mercator's map was designed for marine navigation. Lines of constant bearing are straight.</p>
</div>
<div class="slide image_bottom">
<img src="images/directions.jpg"/>
<p>At a local scale, this means that shape and direction are preserved.</p>
</div>
<div class="slide">
<img src="images/squish.jpg"/>
<p>And that's generally a good thing.</p>
<a class="citation" target="_blank" href="http://idvux.wordpress.com/2007/06/06/mercator-vs-well-not-mercator-platte-carre/">John Nelson, Plate carrée squish effect</a>
</div>
<div class="slide image_full">
<img src="images/world.jpg"/>
<p>A Mercator map of the world is not a map of the world.</p>
</div>
<div class="slide">
<p>ln(tan 90° + sec 90°) = Infinity</p>
</div>
<div class="slide">
<img src="images/poles.gif"/>
</div>
<div class="slide">
<img src="images/world_cutoff.jpg"/>
</div>
<div class="slide">
<img src="images/southpole.jpg"/>
</div>
<div class="slide image_full">
<img src="images/suspicious.jpg"/>
<p>Be suspicious of web map comparisons "at the same scale."</p>
</div>
<div class="slide">
<iframe width="100%" height="95%" frameborder="0" src="https://gmaps-samples.googlecode.com/svn/trunk/poly/puzzledrag.html"></iframe>
</div>
<div class="slide">
<p>ZOOM LEVEL ≠ SCALE</p>
</div>
<div class="slide">
<img src="images/quito.jpg"/>
</div>
<div class="slide">
<img src="images/oslo.jpg"/>
</div>
<div class="slide">
<img src="images/z16.jpg"/>
</div>
<div class="slide">
<img src="images/mercator_choro.jpg"/>
<p>So avoid areal representations in web maps at small scale.</p>
</div>
<div class="slide image_full">
<p>Web maps are more than just tiles.</p>
<img src="images/pins.jpg"/>
</div>
<div class="slide">
<p>Dynamic, interactive <em>feature layers</em> are the important other half of many web maps.</p>
</div>
<div class="slide">
<img src="images/osm_tile.png"/>
<p>Tiles, typically: raster, non-interactive<a href="https://www.mapbox.com/blog/how-interactivity-works-utfgrid/" target="_blank">*</a>, used as a base layer</p>
</div>
<div class="slide">
<p>Feature layers, typically: interactive, vector, represent the map's salient data</p>
<iframe src="http://leafletjs.com/examples/quick-start-example.html" scrolling="no" frameborder="0" width="600" height="400" style="position:absolute;bottom:100px;left:212px"></iframe>
</div>
<div class="slide">
<p><a href="http://en.wikipedia.org/wiki/GeoJSON" target="_blank">GeoJSON</a> is a geographic data format that plays well with web maps for feature layers</p>
<img src="images/geojson.png"/>
</div>
<div class="slide image_full">
<p>How does all this fit together?</p>
<img src="images/puzzle.jpg"/>
</div>
<div class="slide">
<img src="images/diagram.jpg"/>
</div>
<div class="slide">
<p>Thats not all folks!<br/>Welcome to the world of Web Maps!
</p>
</div>
<script>
// The following is mostly derived from https://github.com/tmcw/big
var slides = document.getElementsByClassName("slide"),
current = 0;
function go(n){
current = n;
var slide = slides[n],
classes = slide.className.split(" ");
for (var i = 0; i < slides.length; i++) slides[i].style.display = 'none';
slide.style.display = 'block';
slide.style.left = (window.innerWidth - slide.offsetWidth) / 2 + "px";
slide.style.top = (window.innerHeight - slide.offsetHeight) / 2 + "px";
if ( classes[1] && styleSlide[classes[1]] ) styleSlide[classes[1]](slide);
else styleSlide.normal(slide);
resize();
if (window.location.hash !== n) window.location.hash = n;
}
var styleSlide = {
heading: function(slide){
var p = slide.getElementsByTagName("p")[0];
p.style.marginTop = (slide.offsetHeight - p.offsetHeight) / 2 + "px";
},
image_full: function(slide){
var img = slide.getElementsByTagName("img")[0];
var p = slide.getElementsByTagName("p")[0];
var div = slide.getElementsByTagName("div")[0] || document.createElement("div");
div.style.backgroundImage = 'url(' + img.src + ')';
slide.insertBefore(div,p);
img.style.display = 'none';
p.style.marginTop = (slide.offsetHeight - p.offsetHeight) / 2 + "px";
},
image_bottom: function(slide){
var img = slide.getElementsByTagName("img")[0];
if ( !img ) return;
slide.style.backgroundImage = 'url(' + img.src + ')';
img.style.display = 'none';
},
normal: function(slide){
var img = slide.getElementsByTagName("img")[0];
var p = slide.getElementsByTagName("p")[0];
if ( img ){
slide.style.backgroundImage = 'url(' + img.src + ')';
} else if (!img && !slide.getElementsByTagName("iframe")[0]){
if ( p ){
p.style.marginTop = (slide.offsetHeight - p.offsetHeight) / 2 + "px";
}
}
}
}
document.onclick = function() { go(++current % (slides.length)); };
function fwd() { go(Math.min(slides.length - 1, ++current)); }
function rev() { go(Math.max(0, --current)); }
document.onkeydown = function(e) {
if (e.which === 39 || e.which === 34 || e.which === 40) fwd();
if (e.which === 37 || e.which === 33 || e.which === 38) rev();
};
document.ontouchstart = function(e) {
var x0 = e.changedTouches[0].pageX;
document.ontouchend = function(e) {
var x1 = e.changedTouches[0].pageX;
if (x1 - x0 < 0) fwd();
if (x1 - x0 > 0) rev();
};
};
function parse_hash() {
return Math.max(Math.min(slides.length - 1,
parseInt(window.location.hash.substring(1), 10)), 0);
}
if (window.location.hash) current = parse_hash() || current;
window.onhashchange = function() {
var c = parse_hash();
if (c !== current) go(c);
};
window.onresize = resize;
function resize(){
var s = Math.min( 1, Math.min( window.innerHeight / 768, window.innerWidth / 1024 ) );
slides[current].style.webkitTransform = "scale(" + s + "," + s +")";
slides[current].style.MozTransform = "scale(" + s + "," + s +")";
slides[current].style.msTransform = "scale(" + s + "," + s +")";
slides[current].style.transform = "scale(" + s + "," + s +")";
}
go(current);
</script>
</body>
</html>