Make It Rain with Mapbox GL
Franz Neubert
Me
• Software Engineer

• Javascript, Maps, Data Visualisation
@Scarysize /Scarysize
visit hvv.live
Ubilabs
• Interactive map applications

• Data visualisation

• VR

• Google Maps Partner
WebGL
• Rasterisation engine

• Drawing points, lines & triangles

• Shaders running on the GPU
SETUP STATE DRAW
coordinates, buffers, textures… execute shaders on state
Setup
Vertex Shader
Rasterisation
Fragment Shader
Rendering
Mapbox GL JS
• Interactive Maps with Vector Tiles

• WebGL based

• Comprehensive
Source 1
Source 2
Layer 1
Layer 5
Layer 3
Layer 2
Layer 4
GeoJSON Source
Circle Layer
Line Layer
Fill Layer
Data-driven Raster Tiles
• Minimise data transmission

• Minimise server load & cost

• Maximise flexibility on the client
• Encode data as grey value

• Transmit “data” PNG tiles

• Colour tiles on the client
0
.
.
.
255
-50°C
.
.
.
50°C
#42D7F4
.
.
.
#F47141
Value Mapping Colour Mapping
• Create 256 * 1 look-up texture

• Use grey value as index into the look-up texture

• Can be static or generated dynamically
Shader
Shader
Shader
• 3072 * 1536 values

• Gray scale 0 - 100
filesizeinKB
0
2500
5000
7500
10000
GEOTIFF GIF PNG JPEG
• Use grey “data” tiles

• Map colour to domain value

• Flexibly colorise tiles on the client 🌈
Grid Data
• Minimise data transmission

• Minimise server load & cost

• Maximise flexibility on the client
filesizeinMB
0
31.25
62.5
93.75
125
0.3
24
125
20
40
filesizeinMB
0
31.25
62.5
93.75
125
CSV CSV gzipped JSON JSON gzipped PNG
0.3
24
125
20
40
• Encode data as grey value

• Transmit “data” PNG
images

• Sample images based on
current viewport
x x x
x x x
x x x
x x x
x x x
x x x
[10, -34]
[15, -29]
[10, -34]
[15, -29]
X Component Y Component
• Massively reduce file size using images

• Sample images based on viewport

• Render as GeoJSON
Thanks
@Scarysize /ScarysizeFranz Neubert

Make It Rain with Mapbox GL - Franz Neubert