SlideShare a Scribd company logo
August 7, 2015 GOTHENBURG
Client side rendering of maps using MapCSS
Jonas Danielsson <jonas@threetimestwo.org>
Client side rendering of maps using MapCSS 2
Why do we want this?
download less data
makes offline mode feasible
better HiDPI support
rely less on third-party services
our own GNOME style of maps
Client side rendering of maps using MapCSS 3
OpenStreetMaps
collaborative project to create editable map of the world
built by volunteers (2 million of them)
over 30 million changesets
over 20000 changes per day
Client side rendering of maps using MapCSS 4
Mapping
node, way, relations
feature described by tags (key=value)
freestyle tagging
Client side rendering of maps using MapCSS 5
Map tiles
(a) zoom 12 (b) zoom 14 (c) zoom 16
referenced via coordinates (x, y, z)
makes caching easier
progressive loading
zoom levels include 4(zoom level) tiles
Client side rendering of maps using MapCSS 6
zoom tile count
0 1
1 4
2 16
... ...
16 4,294,967,296
17 17,179,869,184
18 68,719,476,736
Client side rendering of maps using MapCSS 7
Vector tiles
same coordinate reference style (x, y, z)
vector representations of the features in the tile
metadata, road names, area types – OSM tags
smaller in size than image tiles
Client side rendering of maps using MapCSS 8
How much smaller?
bounding box of Gothenburg
zoom 14 15 16 17 total total compressed
tiles 309 1045 3980 15481 20814 —
image size 3.2M 9.5M 29M 92M 133M 67M
vector size 3.6M 7.0M 19M 63M 92M 13M
image tiles (PNG) from OpenStreetMap map servers
Mapbox vector tiles, served by Mapzen
the real win is when compressed
Client side rendering of maps using MapCSS 9
Mapbox Vector tile format
Google Protocol buffers as container format
consists of one or more named layers
each layer contains one or more features
features contain attributes and geometry
Client side rendering of maps using MapCSS 10
Mapbox Vector tile format
Feature
layer = landuse
kind = pedestrian
name = Järntorget
area = 17315
source = openstreetmap.org
id = 125675120
contains OpenStreetMap key=value tags
point, linestring or polygon
contains encoded geometry
Client side rendering of maps using MapCSS 11
Mapbox Vector tile format
Geometry
MoveTo(3, 6), LineTo(8, 12), LineTo(20, 34), ClosePath
Encoded as: [ 9 6 12 18 10 12 24 44 15 ]
| | ‘> [00001 111] command type 7 (ClosePath), length 1
| | ===== relative LineTo(+12, +22) == LineTo(20, 34)
| | ===== relative LineTo(+5, +6) == LineTo(8, 12)
| ‘> [00010 010] = command type 2 (LineTo), length 2
| ==== relative MoveTo(+3, +6)
‘> [00001 001] = command type 1 (MoveTo), length 1
contains a stream of repeatable commands
MoveTo, LineTo, ClosePath
parameters uses zigzag encoding
Client side rendering of maps using MapCSS 12
way[highway=secondary],
way[highway=road],
way[highway=residential] {
width: 7;
color: white;
z-index: 5;
}
stylesheet language for maps
operates on OSM tags, supports zoom filters
Client side rendering of maps using MapCSS 13
MapCSS
selectors
canvas {
color: #FAEBD7;
}
OpenStreetMap object types
node
way
relation
special cases
area
line
canvas
*
Client side rendering of maps using MapCSS 14
MapCSS
tests
way[is_tunnel=yes] {
dashes: 3, 3;
}
way|z8-17[highway=motorway][is_bridge=yes] {
casing-color: #cc6500;
}
binary operators allowed: !=, !=, = , >, <, >=, <=
or unary: way[highway]
restrict to zoom level: area|z17-19[building]
Client side rendering of maps using MapCSS 15
What do we have?
vector-tile-glib
(d) MapQuest (e) vector-tile-glib
uses GLib and GObject
renders Mapbox Vector tile format
supports a subset of MapCSS
Client side rendering of maps using MapCSS 16
vector-tile-glib
mapbox.render_async(cr, function() {
surface.writeToPNG(’test.png’);
Mainloop.quit(’test-bindings’);
});
currently uses flex as tokenizer and lemon as parser
supports a subset of MapCSS
hooks into libchamplain and can be used by Maps
hosted on Github
Client side rendering of maps using MapCSS 17
Style help needed
Client side rendering of maps using MapCSS 18
Some way to go
Client side rendering of maps using MapCSS 19
Roadmap / wishlist
infrastructure to serve vector tiles
tiles.gnome.org?
rely on third-party?
improve vector-tile-glib
keep beutifying the style
add offline support to libchamplain / Maps
offline search?
Client side rendering of maps using MapCSS 20
Get involved!
We need you!
Client side rendering of maps using MapCSS 21
Questions?

More Related Content

PDF
Smooth, Interactive Rendering and On-line Modification of Large-Scale, Geospa...
PDF
QGIS Module 2
PDF
3D Web Services And Models For The Web: Where Do We Stand?
PDF
Geographical Information System (GIS) Georeferencing and Digitization, Bihar ...
PDF
QGIS training
PPT
Session 38 Martin Holmstedt
PDF
QGIS Tutorial 1
PDF
QGIS Module 3
Smooth, Interactive Rendering and On-line Modification of Large-Scale, Geospa...
QGIS Module 2
3D Web Services And Models For The Web: Where Do We Stand?
Geographical Information System (GIS) Georeferencing and Digitization, Bihar ...
QGIS training
Session 38 Martin Holmstedt
QGIS Tutorial 1
QGIS Module 3

What's hot (19)

PDF
QGIS Tutorial 2
PPTX
Use of CityGML standard in the context of Smart City
PDF
QGIS training class 1
PPTX
3D enabling Smart Cities
PPT
11 1 Areas Of Rectangles
DOCX
Assignment vector raster
ODP
Making Beautiful Maps: Oct 5 2011
PDF
QGIS Module 4
PPTX
Geographic information system and remote sensing
PDF
Velocity model building in Petrel
PPT
Lar calc10 ch07_sec1
PPTX
Petrel course Module_1: Import data and management, make simple surfaces
PPTX
data visualization workshop_Krakovetskyi
PPTX
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
PDF
Lecture 13
PDF
232422261 mapinfo-training-slides-190807
PPTX
All the New Cool Stuff in QGIS 2.0
PDF
server-side-fusion-vts
PDF
Processing Landsat 8 Multi-Spectral Images with GRASS Tools & the potential o...
QGIS Tutorial 2
Use of CityGML standard in the context of Smart City
QGIS training class 1
3D enabling Smart Cities
11 1 Areas Of Rectangles
Assignment vector raster
Making Beautiful Maps: Oct 5 2011
QGIS Module 4
Geographic information system and remote sensing
Velocity model building in Petrel
Lar calc10 ch07_sec1
Petrel course Module_1: Import data and management, make simple surfaces
data visualization workshop_Krakovetskyi
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Lecture 13
232422261 mapinfo-training-slides-190807
All the New Cool Stuff in QGIS 2.0
server-side-fusion-vts
Processing Landsat 8 Multi-Spectral Images with GRASS Tools & the potential o...
Ad

Similar to Client side rendering of maps using MapCSS (20)

PDF
Concepts and Methods of Embedding Statistical Data into Maps
PPT
Dynamic Mapping of Raster Data (IV 2009)
PPT
The 21st Century Harvard Map
PDF
State of the Art Web Mapping with Open Source
PPTX
3D WebGIS using Opensource software
PDF
Tilemill gwu-wboykinm
PPTX
Interactive Rendering and Stylization of Transportation Networks Using Distan...
PDF
M2M_250327_22434hjjik7_250411_183538.pdf
PPTX
DDGK: Learning Graph Representations for Deep Divergence Graph Kernels
PPTX
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,transl...
PDF
LSIVIEWER 2.0-A CLIENT-ORIENTED ONLINE VISUALIZATION TOOL FOR GEOSPATIAL VECT...
PPTX
Google charts
PDF
Map visualisation
PDF
OpenLayers Feature Frenzy
DOCX
CAD CAM usage for manufacturing of Solid Relief Maps
PPTX
PDF
DASH: A C++ PGAS Library for Distributed Data Structures and Parallel Algorit...
PPTX
QGIS Training.pptx
PDF
Topoplan - a digital terrain modeling tool
PDF
Machine-Learned_3D_Building_Vectorization_From_Satellite_Imagery__paper.pdf
Concepts and Methods of Embedding Statistical Data into Maps
Dynamic Mapping of Raster Data (IV 2009)
The 21st Century Harvard Map
State of the Art Web Mapping with Open Source
3D WebGIS using Opensource software
Tilemill gwu-wboykinm
Interactive Rendering and Stylization of Transportation Networks Using Distan...
M2M_250327_22434hjjik7_250411_183538.pdf
DDGK: Learning Graph Representations for Deep Divergence Graph Kernels
CHAPTER 4 &5 geoand trans.pptxGeometry chapter 4 and 5 transformation ,transl...
LSIVIEWER 2.0-A CLIENT-ORIENTED ONLINE VISUALIZATION TOOL FOR GEOSPATIAL VECT...
Google charts
Map visualisation
OpenLayers Feature Frenzy
CAD CAM usage for manufacturing of Solid Relief Maps
DASH: A C++ PGAS Library for Distributed Data Structures and Parallel Algorit...
QGIS Training.pptx
Topoplan - a digital terrain modeling tool
Machine-Learned_3D_Building_Vectorization_From_Satellite_Imagery__paper.pdf
Ad

Recently uploaded (20)

PPT
Ethics in Information System - Management Information System
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
Digital Literacy And Online Safety on internet
PDF
Introduction to the IoT system, how the IoT system works
PPTX
SAP Ariba Sourcing PPT for learning material
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PPTX
Internet___Basics___Styled_ presentation
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
artificial intelligence overview of it and more
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
DOCX
Unit-3 cyber security network security of internet system
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Ethics in Information System - Management Information System
Job_Card_System_Styled_lorem_ipsum_.pptx
Digital Literacy And Online Safety on internet
Introduction to the IoT system, how the IoT system works
SAP Ariba Sourcing PPT for learning material
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
Internet___Basics___Styled_ presentation
522797556-Unit-2-Temperature-measurement-1-1.pptx
artificialintelligenceai1-copy-210604123353.pptx
WebRTC in SignalWire - troubleshooting media negotiation
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
artificial intelligence overview of it and more
Design_with_Watersergyerge45hrbgre4top (1).ppt
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Exploring VPS Hosting Trends for SMBs in 2025
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Unit-3 cyber security network security of internet system
Power Point - Lesson 3_2.pptx grad school presentation
Introduction about ICD -10 and ICD11 on 5.8.25.pptx

Client side rendering of maps using MapCSS

  • 1. August 7, 2015 GOTHENBURG Client side rendering of maps using MapCSS Jonas Danielsson <jonas@threetimestwo.org>
  • 2. Client side rendering of maps using MapCSS 2 Why do we want this? download less data makes offline mode feasible better HiDPI support rely less on third-party services our own GNOME style of maps
  • 3. Client side rendering of maps using MapCSS 3 OpenStreetMaps collaborative project to create editable map of the world built by volunteers (2 million of them) over 30 million changesets over 20000 changes per day
  • 4. Client side rendering of maps using MapCSS 4 Mapping node, way, relations feature described by tags (key=value) freestyle tagging
  • 5. Client side rendering of maps using MapCSS 5 Map tiles (a) zoom 12 (b) zoom 14 (c) zoom 16 referenced via coordinates (x, y, z) makes caching easier progressive loading zoom levels include 4(zoom level) tiles
  • 6. Client side rendering of maps using MapCSS 6 zoom tile count 0 1 1 4 2 16 ... ... 16 4,294,967,296 17 17,179,869,184 18 68,719,476,736
  • 7. Client side rendering of maps using MapCSS 7 Vector tiles same coordinate reference style (x, y, z) vector representations of the features in the tile metadata, road names, area types – OSM tags smaller in size than image tiles
  • 8. Client side rendering of maps using MapCSS 8 How much smaller? bounding box of Gothenburg zoom 14 15 16 17 total total compressed tiles 309 1045 3980 15481 20814 — image size 3.2M 9.5M 29M 92M 133M 67M vector size 3.6M 7.0M 19M 63M 92M 13M image tiles (PNG) from OpenStreetMap map servers Mapbox vector tiles, served by Mapzen the real win is when compressed
  • 9. Client side rendering of maps using MapCSS 9 Mapbox Vector tile format Google Protocol buffers as container format consists of one or more named layers each layer contains one or more features features contain attributes and geometry
  • 10. Client side rendering of maps using MapCSS 10 Mapbox Vector tile format Feature layer = landuse kind = pedestrian name = Järntorget area = 17315 source = openstreetmap.org id = 125675120 contains OpenStreetMap key=value tags point, linestring or polygon contains encoded geometry
  • 11. Client side rendering of maps using MapCSS 11 Mapbox Vector tile format Geometry MoveTo(3, 6), LineTo(8, 12), LineTo(20, 34), ClosePath Encoded as: [ 9 6 12 18 10 12 24 44 15 ] | | ‘> [00001 111] command type 7 (ClosePath), length 1 | | ===== relative LineTo(+12, +22) == LineTo(20, 34) | | ===== relative LineTo(+5, +6) == LineTo(8, 12) | ‘> [00010 010] = command type 2 (LineTo), length 2 | ==== relative MoveTo(+3, +6) ‘> [00001 001] = command type 1 (MoveTo), length 1 contains a stream of repeatable commands MoveTo, LineTo, ClosePath parameters uses zigzag encoding
  • 12. Client side rendering of maps using MapCSS 12 way[highway=secondary], way[highway=road], way[highway=residential] { width: 7; color: white; z-index: 5; } stylesheet language for maps operates on OSM tags, supports zoom filters
  • 13. Client side rendering of maps using MapCSS 13 MapCSS selectors canvas { color: #FAEBD7; } OpenStreetMap object types node way relation special cases area line canvas *
  • 14. Client side rendering of maps using MapCSS 14 MapCSS tests way[is_tunnel=yes] { dashes: 3, 3; } way|z8-17[highway=motorway][is_bridge=yes] { casing-color: #cc6500; } binary operators allowed: !=, !=, = , >, <, >=, <= or unary: way[highway] restrict to zoom level: area|z17-19[building]
  • 15. Client side rendering of maps using MapCSS 15 What do we have? vector-tile-glib (d) MapQuest (e) vector-tile-glib uses GLib and GObject renders Mapbox Vector tile format supports a subset of MapCSS
  • 16. Client side rendering of maps using MapCSS 16 vector-tile-glib mapbox.render_async(cr, function() { surface.writeToPNG(’test.png’); Mainloop.quit(’test-bindings’); }); currently uses flex as tokenizer and lemon as parser supports a subset of MapCSS hooks into libchamplain and can be used by Maps hosted on Github
  • 17. Client side rendering of maps using MapCSS 17 Style help needed
  • 18. Client side rendering of maps using MapCSS 18 Some way to go
  • 19. Client side rendering of maps using MapCSS 19 Roadmap / wishlist infrastructure to serve vector tiles tiles.gnome.org? rely on third-party? improve vector-tile-glib keep beutifying the style add offline support to libchamplain / Maps offline search?
  • 20. Client side rendering of maps using MapCSS 20 Get involved! We need you!
  • 21. Client side rendering of maps using MapCSS 21 Questions?