Slide 1

Slide 1 text

Leaflet, WebGL and the future of web mapping Vladimir Agafonkin 11.03.15

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Vladimir Agafonkin

Slide 4

Slide 4 text

by far the most used open source map library

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

creating a web map in 2008

Slide 17

Slide 17 text

born against all odds

Slide 18

Slide 18 text

no way you could do that

Slide 19

Slide 19 text

You’re wasting time

Slide 20

Slide 20 text

build an OPENLAYERS wrapper

Slide 21

Slide 21 text

born as a protest against bloat, clutter and complexity

Slide 22

Slide 22 text

top priorities: simplicity performance

Slide 23

Slide 23 text

feature need complexity simplify

Slide 24

Slide 24 text

1.0

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

0.7 1.0-dev WTF yay!

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Leaflet 1.0 trap, episode 1 of many: flyover animations

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

arbitrary animation curve fractional zoom

Slide 33

Slide 33 text

fractional zoom: map.setZoom(12.67)

Slide 34

Slide 34 text

arbitrary animation curve multi-zoom pyramid tile loading

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

fractional zoom rewrite half of Leaflet code

Slide 37

Slide 37 text

code refactoring

Slide 38

Slide 38 text

CSS transitions: very fast, impossible to control precisely, still buggy

Slide 39

Slide 39 text

frame by frame animations: full control, much slower

Slide 40

Slide 40 text

significantly degrade Leaflet performance, or introduce confusing limitations, fragility and complexity by having two animation systems?

Slide 41

Slide 41 text

sometimes browsers break

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

sorry guys

Slide 44

Slide 44 text

oh and did I mention Android?

Slide 45

Slide 45 text

tweaking leaflet animations

Slide 46

Slide 46 text

my map broke in IE7!!!

Slide 47

Slide 47 text

tough problems, hard choices, uncertainty, constant stream of issues and support requests, lots of work

Slide 48

Slide 48 text

feeling anxiety and guilt and pressure

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

open source burnout

Slide 51

Slide 51 text

vlad adds a feature to leaflet

Slide 52

Slide 52 text

it’s a trap!

Slide 53

Slide 53 text

Vlad retreats to his happy place

Slide 54

Slide 54 text

RBush

Slide 55

Slide 55 text

• rbush • earcut • simpleheat • simplify-js • geojson-vt • pbf • geobuf • suncalc • dead-simple-grid • bullshit.js

Slide 56

Slide 56 text

war in ukraine

Slide 57

Slide 57 text

father of twin girls

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

0.7.3 — 1.0

Slide 61

Slide 61 text

sharing the joy of successful refactoring

Slide 62

Slide 62 text

animations & usability

Slide 63

Slide 63 text

flyover animations

Slide 64

Slide 64 text

much better tile loading (smoother, less flickering)

Slide 65

Slide 65 text

much better panning inertia

Slide 66

Slide 66 text

smoother zoom on iOS Safari

Slide 67

Slide 67 text

popup fade out animation

Slide 68

Slide 68 text

accessibility improvements

Slide 69

Slide 69 text

vectors 2.0

Slide 70

Slide 70 text

Use SVG & Canvas on the same map

Slide 71

Slide 71 text

put vectors in custom panes

Slide 72

Slide 72 text

huge SVG layers performance boost: adding ~3x faster, takes ~2.5 less memory

Slide 73

Slide 73 text

huge Canvas layers performance boost: partial redraws, faster mouse events

Slide 74

Slide 74 text

Canvas layers now retina-enabled

Slide 75

Slide 75 text

solved all problems with MultiPolygon & MultiPolyline: no longer inherited from FeatureGroup

Slide 76

Slide 76 text

Polyline & Polygon Centroids

Slide 77

Slide 77 text

TileLayer

Slide 78

Slide 78 text

TileLayer split into GridLayer & TileLayer

Slide 79

Slide 79 text

GridLayer is the new TileLayer.Canvas

Slide 80

Slide 80 text

Projections

Slide 81

Slide 81 text

No hardcoded projection hacks, all centralized in CRS

Slide 82

Slide 82 text

CRS defines everything: how tiles wrap, what are the bounds, distance measure, etc.

Slide 83

Slide 83 text

Proj4Leaflet FTW

Slide 84

Slide 84 text

Layers

Slide 85

Slide 85 text

all layers now inherited from Layer class less code, more consistency, good for plugins

Slide 86

Slide 86 text

Custom Pane Management

Slide 87

Slide 87 text

ImageOverlay events

Slide 88

Slide 88 text

other performance improvements

Slide 89

Slide 89 text

much faster Layer construction (delegated DOM events and other optimizations)

Slide 90

Slide 90 text

huge FeatureGroup performance boost due to better event propagation mechanism

Slide 91

Slide 91 text

much better memory footprint for DOM & Leaflet events

Slide 92

Slide 92 text

LatLng construction 8x faster

Slide 93

Slide 93 text

obj.off(event, listener) 2x faster

Slide 94

Slide 94 text

more stable: less freezes and race conditions

Slide 95

Slide 95 text

…and many other bugfixes and improvements

Slide 96

Slide 96 text

best of all? it got smaller!

Slide 97

Slide 97 text

Uncompressed: 212.80 KB (-2910 bytes) Compressed: 120.17 KB (-2482 bytes) Gzipped: 32.79 KB (+18 bytes) master vs stable

Slide 98

Slide 98 text

state of 1.0

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

1.0 beta

Slide 101

Slide 101 text

VLAD TRIES TO FINISH 1.0

Slide 102

Slide 102 text

Leaflet’s neat, but Vlad, wouldn’t it be awesome to have rotation? ^___^

Slide 103

Slide 103 text

No content

Slide 104

Slide 104 text

Mapbox GL

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

No content

Slide 110

Slide 110 text

No content

Slide 111

Slide 111 text

drawing a line in WebGL

Slide 112

Slide 112 text

No content

Slide 113

Slide 113 text

No content

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

drawing a line in WebGL is a hard problem

Slide 116

Slide 116 text

drawing a polygon in WebGL

Slide 117

Slide 117 text

github.com/mapbox/earcut

Slide 118

Slide 118 text

drawing a polygon in WebGL is a very hard problem

Slide 119

Slide 119 text

drawing text in WebGL

Slide 120

Slide 120 text

No content

Slide 121

Slide 121 text

No content

Slide 122

Slide 122 text

placing labels in Mapbox GL

Slide 123

Slide 123 text

No content

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

holy f***ing sh*t

Slide 127

Slide 127 text

displaying GeoJSON in Mapbox GL

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

github.com/mapbox/geojson-vt

Slide 130

Slide 130 text

vlad tries to borrow Mapbox GL feature for leaflet

Slide 131

Slide 131 text

Vlad, how about adding a WebGL renderer to Leaflet? ^___^

Slide 132

Slide 132 text

No content

Slide 133

Slide 133 text

meant to be simple

Slide 134

Slide 134 text

Leaflet will remain the go-to mapping library: dead simple, easy to use, works on all platforms, 
 tons of plugins, huge community, everyone knows it

Slide 135

Slide 135 text

meant to be very complex, and push the boundaries of what’s possible Mapbox GL

Slide 136

Slide 136 text

opposite sides of spectrum

Slide 137

Slide 137 text

excited to be pushing both

Slide 138

Slide 138 text

No content