Slide 1

Slide 1 text

Leaflet.MapboxVectorTile Vector Tiles

Slide 2

Slide 2 text

“Old School” PNG Raster Tiles • Just a grid of PNG images that you can slip around… Actual PNG Tile From OpenStreetMap Zoomed In…

Slide 3

Slide 3 text

Raster Tile Discrete colors for each pixel. Need a data value for each pixel…

Slide 4

Slide 4 text

4 Vector Tiles All of the relevant big players in mapping use this…

Slide 5

Slide 5 text

Vector Tile No colors at all… It is a bunch of arrays in a 256 x 256 matrix. [ (x1,y1), (x2,y2), (x3,y3) …]

Slide 6

Slide 6 text

Here’s what we would have ! if there are two lines in a tile… [ (x1,y1), (x2,y2), (x3,y3) …], [ (x1,y1), (x2,y2), (x3,y3) …]

Slide 7

Slide 7 text

Same Tile Schema as PNG • Same addressing scheme as PNG Tiles • ( Google / OpenStreetMap Schema ) tileurl.com/4/2/5.png tileurl.com/4/2/5.pbf

Slide 8

Slide 8 text

Specification • Decodes binary protocal buffer (Google) files that adhere to the Mapobox Vector Tile (Mapbox) Specification. https://github.com/mapbox/vector-tile-spec

Slide 9

Slide 9 text

Why not GeoJSON? • A protocal buffer is a binary format that is very terse and compact, so it requires much less bandwidth than text-encoded JSON. • It automatically simplifies geometries appropriately to your given zoom level. • You cut out all of the extra data that the renderer never even uses…

Slide 10

Slide 10 text

What do the values look like? • Data values are decoded into pixel coordinates relative to the origin of the tile. • If 2 points are in a pixel, it is automatically simplified into 1 point. • This is in a post-projection space. It is exactly in the correct form for your renderer…

Slide 11

Slide 11 text

Each tile is a separate HTML5 Canvas. Polygon Framgent 1 Polygon Framgent 2 of the Democratic Republic of Congo Feature

Slide 12

Slide 12 text

This means each tile is being rendered by your GPU in parallel. FAST!

Slide 13

Slide 13 text

SpatialServer: Leaflet.MapboxVectorTile https://github.com/SpatialServer/Leaflet.MapboxVectorTile/ ! https://www.npmjs.org/package/leaflet-mapbox-vector-tile npm install leaflet-mapbox-vector-tile

Slide 14

Slide 14 text

HTML5 Canvas Experiments

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

How does this relate to MapboxGL? • Leaflet.MapboxVectorTile renders vector tiles as a set of canvas tile layers in Leaflet. • MapboxGL is more advanced than Leaflet and runs primarily from vector tiles. This uses OpenGL / WebGL instead of HTML5 canvas to render. It is more performant, but it is less stable than Leaflet and does not work on Internet Exploder.

Slide 17

Slide 17 text

How do I make Mapbox Vector Tiles?

Slide 18

Slide 18 text

Option 1: Mapbox Studio

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

What if I need / want to create these things dynamically???

Slide 26

Slide 26 text

The Spatial Server (formally known as Chubbs)… If you want Mapbox to serve it, you need to pre-render your tiles into .mbtiles format… SpatialServer looks at PostGIS tables and cuts you tiles on the fly!

Slide 27

Slide 27 text

No content