Your SlideShare is downloading. ×
Mapnik Sotm 2007
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Mapnik Sotm 2007

4,504
views

Published on

SOTM07 Artem Pavlenko - Putting the map into OSM: rendering geo-data with Mapnik (July 14, 2007)

SOTM07 Artem Pavlenko - Putting the map into OSM: rendering geo-data with Mapnik (July 14, 2007)

Published in: Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,504
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
119
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Putting the map into OSM: rendering geo-data with Mapnik Artem Pavlenko mapnik.org
  • 2. A brief history of (web)mapping
    • Good old 70 s GIS
    • OGC – WMS, WFS, W*S ...
    • Google Maps
    • [???]
  • 3. Why did I like Google Maps?
    • No Java, no Flash, no ActiveX
    • No W*S
    • Lots of data
    • Good looking maps
    • APIs
  • 4. What was the problem, then?
      • It is not free!
      • Data is subject to license and rendering software is proprietary
  • 5. Searching for the solution
      • In the post GMap world we expect web mapping to be:
      • Fast
      • Highly interactive
      • And to have good cartography
    At the time, none of the FOSS tools delivered these...
  • 6. Mapnik
  • 7. Mapnik is not ...
    • GIS
    • A map server, though you can hack one with Mapnik in no time
    • Attempt to implement all OGC specs in Java and bully the rest for not doing so
    • MapNick – I'm not Nick ...
  • 8. Mapnik is ...
    • About making beautiful maps
    • What I wanted to use myself
    • F/OSS
    • Cross platform – Linux, Mac OS X, Win32
    • Written in modern c++
    • Easy to get started (Python bindings)
    • Flexible design
  • 9.  
  • 10.  
  • 11.  
  • 12. How do you make a map?
  • 13. Making a map is easy
      • from mapnik import *
      • m = Map(800,600)
      • load_map(m,'/Users/artem/map.xml')
      • m.zoom_to_box(Envelope(-180,-90,180,90))
      • render_to_file(m,"world.jpg","jpeg")
      • What is *.xml?
  • 14. Making a map is easy
      • <Map bgcolor='steelblue'>
      • </Map>
  • 15. Making a map is easy
      • <Map bgcolor='steelblue'>
      • <Layer name='mylayer'>
      • <Datasource type='shape' file='/tmp/world'/>
      • </Layer>
      • </Map>
  • 16. Making a map is easy (almost)
      • <Map bgcolor='steelblue'>
      • <Style name='My Style'>
      • <Rule>
      • <PolygonSymbolizer>
      • <CssParameter name='fill'>lightgrey</CssParameter>
      • </PolygonSymbolizer>
      • <LineSymbolizer>
      • <CssParameter name='stroke'>white</CssParameter>
      • </LineSymbolizer>
      • </Rule>
      • </Style>
      • <Layer name='countries'>
      • <Style>MyStyle</Style>
      • <Datasource type='shape' file='/tmp/shapefile/world' />
      • </Layer>
      • </Map>
  • 17. Making a map is fun
      • f rom mapnik import *
      • m = Map(800,600,&quot;+proj=latlong +datum=WGS84&quot;)
      • m.background = Color('steelblue')
      • s = Style()
      • r=Rule()
      • r.symbols.append(PolygonSymbolizer(Color('#f2eff9')))
      • r.symbols.append(LineSymbolizer(Color('rgb(50%,50%,50%)'),0.1))
      • s.rules.append(r)
      • m.append_style('My Style')
      • lyr = Layer('world')
      • lyr.datasource Shapefile(file='/opt/data/countries')
      • lyr.styles.append('My Style')
      • m.layers.append(lyr)
      • m.zoom_to_box(lyr.envelope())
      • render_to_file(m,'world.jpg', 'jpeg')
  • 18. Made it!
  • 19. More about styling...
    • Named styles, each layer can have 0...N style(s)
    • Order is important – 'painter model'
    • 0...N Styles -> 0...N Rules ->(Min/Max Scale Denominator, Filter, 0...N Symbolizer(s))
    • Filter is 'filter expression'
  • 20. Filter expressions - DSEL
    • Syntax for filter expressions is very simple, you enclose variables (evaluated at runtime) in square brackets - [var]
    • Arithmetics: + , - , * , /
    • Comparison: = , <> , > , < , >= ,<=
    • Logical operators: and, or , not
    • regular expressions: [attribute].match('your_reg_ex')
  • 21. Filter expressions - examples
      • [highway] = 'motorway' or 'motorway_link' = [highway]
      • [cfcc].match('^A1[0-9]')
      • [area] > 1000 and [area] <= (1000*2)
  • 22. Making an OpenStreetMap
      • Challenges and opportunities
  • 23. The first challenge
      • Data entered by real people
      • uclassified uhclassified unc lassified unclasiffied unclasified unclassfied unclassiefied unclassifed unclassifeid unclassiffied unclassified unclassified unclessified uncliassified undefined ...
      • 'horse' = 'yes'
      • 'village_green'
  • 24. Facing the challenge
    • Data processing : compile raw OSM data into domain specific formats suited for rendering, routing, small devices etc.
    • We have some tools already: osm2pgsql, osm2shp, osm2kml, osm2whatever but we'll need more.
  • 25. osm2pgsql
    • $ osm2pgsql planet.osm.bz2
    • Outputs 'clean' geometries
    • Builds polygons
    • Assigns z-order
    • ~30 minutes on my laptop
    • planet.osm -> osm2pgsql -> postgresql/postgis
  • 26. More challenges
    • Visualising 'live' data
    • Users want reward for their efforts: “ where is my track on the map? I want it now!”
  • 27. Possible solutions
    • Mapnik at home?
    • Planet.diff?
    • Direct rendering from live OSM database?
  • 28. Tiles. How many?
    • Level 1 - 4 tiles
    • Level 2 - 16 tiles
    • Level 18 - 68719476736 tiles :(
    • Let user decide - 3244998 tiles :)
    • More resources will be needed very soon!
  • 29. Yet another challenge! Or do I mean opportunity...
      • Number of map features will continue to grow...
      • (osm.)XML sucks!
      • What is the answer?
  • 30. Map editor? OSM Illustrator?
  • 31. An opportunity for Mapnik
    • OSM style community scrutiny and effort are invaluable
    • Mapnik is FREE and everyone can get involved
    • To play with some new features grab the ISO image from: http:// artem.dev.openstreetmap.org/files/osm-linux.iso
  • 32. A future history of (web)mapping?
    • Good old 70 s GIS
    • OGC – WMS, WFS, W*S
    • Google Maps
    • [OpenStreetMap]
  • 33. Thank you!