• Like
  • Save
Mapnik Sotm 2007
Upcoming SlideShare
Loading in...5
×
 

Mapnik Sotm 2007

on

  • 6,569 views

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)

Statistics

Views

Total Views
6,569
Views on SlideShare
6,541
Embed Views
28

Actions

Likes
1
Downloads
117
Comments
0

3 Embeds 28

http://sotm2007recordings.blogspot.com 19
http://www.slideshare.net 8
http://209.85.165.104 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Mapnik Sotm 2007 Mapnik Sotm 2007 Presentation Transcript

    • Putting the map into OSM: rendering geo-data with Mapnik Artem Pavlenko mapnik.org
    • A brief history of (web)mapping
      • Good old 70 s GIS
      • OGC – WMS, WFS, W*S ...
      • Google Maps
      • [???]
    • Why did I like Google Maps?
      • No Java, no Flash, no ActiveX
      • No W*S
      • Lots of data
      • Good looking maps
      • APIs
    • What was the problem, then?
        • It is not free!
        • Data is subject to license and rendering software is proprietary
    • 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...
    • Mapnik
    • 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 ...
    • 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
    •  
    •  
    •  
    • How do you make a map?
    • 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?
    • Making a map is easy
        • <Map bgcolor='steelblue'>
        • </Map>
    • Making a map is easy
        • <Map bgcolor='steelblue'>
        • <Layer name='mylayer'>
        • <Datasource type='shape' file='/tmp/world'/>
        • </Layer>
        • </Map>
    • 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>
    • 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')
    • Made it!
    • 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'
    • 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')
    • Filter expressions - examples
        • [highway] = 'motorway' or 'motorway_link' = [highway]
        • [cfcc].match('^A1[0-9]')
        • [area] > 1000 and [area] <= (1000*2)
    • Making an OpenStreetMap
        • Challenges and opportunities
    • 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'
    • 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.
    • osm2pgsql
      • $ osm2pgsql planet.osm.bz2
      • Outputs 'clean' geometries
      • Builds polygons
      • Assigns z-order
      • ~30 minutes on my laptop
      • planet.osm -> osm2pgsql -> postgresql/postgis
    • More challenges
      • Visualising 'live' data
      • Users want reward for their efforts: “ where is my track on the map? I want it now!”
    • Possible solutions
      • Mapnik at home?
      • Planet.diff?
      • Direct rendering from live OSM database?
    • 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!
    • Yet another challenge! Or do I mean opportunity...
        • Number of map features will continue to grow...
        • (osm.)XML sucks!
        • What is the answer?
    • Map editor? OSM Illustrator?
    • 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
    • A future history of (web)mapping?
      • Good old 70 s GIS
      • OGC – WMS, WFS, W*S
      • Google Maps
      • [OpenStreetMap]
    • Thank you!