SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
OpenStreetMap and Python

                       Andrii V. Mishkovskyi


                           October 27, 2009



Andrii V. Mishkovskyi ()     OpenStreetMap and Python   October 27, 2009   1 / 23
What is OpenStreetMap?
In short:


 The Wikipedia of
      Maps
Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   2 / 23
What is OpenStreetMap?

        Free
        CC-by-SA
        Constantly evolving
        Easy to start




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   3 / 23
Languages used

        Ruby                                            site
        C++                    rendering, editors, utilities
        Python                         rendering, utilities
        Java                              utilities, editors
        PHP                                             wiki



Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   4 / 23
Python tools

        bulk upload.py
        PythonOsmApi
        CloudMade’s Python API
        Mapnik




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   5 / 23
Outline

            Mapnik
            Other tools




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   6 / 23
Overview

        Render tool
        Written in C++
        Boost.Python for bindings
        Lots of input plugins
        PNG, JPG, SVG, PDF output



Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   7 / 23
Example, part 1
import mapnik
map = mapnik.Map()
map.background = mapnik.Color(’steelblue’)
rule = mapnik.Rule()
rule.symbols.append(
    mapnik.PolygonSymbolizer(
        mapnik.Color(’#f2eff9’)))
rule.symbols.append(
    mapnik.LineSymbolizer(
        mapnik.Color(’rgb(50%,50%,50%)’), 0.1))
style = mapnik.Style()
style.rules.append(rule)
map.append_style(’Base’, style)
Example, part 1
import mapnik
map = mapnik.Map()
map.background = mapnik.Color(’steelblue’)
rule = mapnik.Rule()
rule.symbols.append(
    mapnik.PolygonSymbolizer(
        mapnik.Color(’#f2eff9’)))
rule.symbols.append(
    mapnik.LineSymbolizer(
        mapnik.Color(’rgb(50%,50%,50%)’), 0.1))
style = mapnik.Style()
style.rules.append(rule)
map.append_style(’Base’, style)
Example, part 1
import mapnik
map = mapnik.Map()
map.background = mapnik.Color(’steelblue’)
rule = mapnik.Rule()
rule.symbols.append(
    mapnik.PolygonSymbolizer(
        mapnik.Color(’#f2eff9’)))
rule.symbols.append(
    mapnik.LineSymbolizer(
        mapnik.Color(’rgb(50%,50%,50%)’), 0.1))
style = mapnik.Style()
style.rules.append(rule)
map.append_style(’Base’, style)
Example, part 1
import mapnik
map = mapnik.Map()
map.background = mapnik.Color(’steelblue’)
rule = mapnik.Rule()
rule.symbols.append(
    mapnik.PolygonSymbolizer(
        mapnik.Color(’#f2eff9’)))
rule.symbols.append(
    mapnik.LineSymbolizer(
        mapnik.Color(’rgb(50%,50%,50%)’), 0.1))
style = mapnik.Style()
style.rules.append(rule)
map.append_style(’Base’, style)
Example, part 2

layer = mapnik.Layer(’world’,
    "+proj=latlong +datum=WGS84")
layer.datasource = mapnik.Shapefile(
    file=’boundaries.shp’)
layer.styles.append(’Base’)
map.layers.append(layer)
map.zoom_to_box(layer.envelope())
mapnik.render_to_file(map, ’world.png’, ’png’)
Example, part 2

layer = mapnik.Layer(’world’,
    "+proj=latlong +datum=WGS84")
layer.datasource = mapnik.Shapefile(
    file=’boundaries.shp’)
layer.styles.append(’Base’)
map.layers.append(layer)
map.zoom_to_box(layer.envelope())
mapnik.render_to_file(map, ’world.png’, ’png’)
Example, part 2

layer = mapnik.Layer(’world’,
    "+proj=latlong +datum=WGS84")
layer.datasource = mapnik.Shapefile(
    file=’boundaries.shp’)
layer.styles.append(’Base’)
map.layers.append(layer)
map.zoom_to_box(layer.envelope())
mapnik.render_to_file(map, ’world.png’, ’png’)
Example, part 2

layer = mapnik.Layer(’world’,
    "+proj=latlong +datum=WGS84")
layer.datasource = mapnik.Shapefile(
    file=’boundaries.shp’)
layer.styles.append(’Base’)
map.layers.append(layer)
map.zoom_to_box(layer.envelope())
mapnik.render_to_file(map, ’world.png’, ’png’)
Wait for it...
Ta-da!
IRL example, part 1

import mapnik
projection = mapnik.Projection(
    "+proj=merc +a=6378137 +b=6378137 "
    "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 "
    "+no_defs +over +lat_ts=0.0 +units=m")
map = mapnik.Map(900, 600)
mapnik.load_map(map, ’/path/to/style.xml’)
IRL example, part 1

import mapnik
projection = mapnik.Projection(
    "+proj=merc +a=6378137 +b=6378137 "
    "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 "
    "+no_defs +over +lat_ts=0.0 +units=m")
map = mapnik.Map(900, 600)
mapnik.load_map(map, ’/path/to/style.xml’)
IRL example, part 1

import mapnik
projection = mapnik.Projection(
    "+proj=merc +a=6378137 +b=6378137 "
    "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 "
    "+no_defs +over +lat_ts=0.0 +units=m")
map = mapnik.Map(900, 600)
mapnik.load_map(map, ’/path/to/style.xml’)
IRL example, part 1

import mapnik
projection = mapnik.Projection(
    "+proj=merc +a=6378137 +b=6378137 "
    "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 "
    "+no_defs +over +lat_ts=0.0 +units=m")
map = mapnik.Map(900, 600)
mapnik.load_map(map, ’/path/to/style.xml’)
IRL example, part 2

coords = [(30.44, 50.455), (30.465, 50.459)]
coords = [mapnik.Coord(*coord)
          for coord in coords]
coords = [projection.forward(coord)
          for coord in coords]
bbox = mapnik.Envelope(*coords)
map.zoom_to_box(bbox)
mapnik.render_to_file(
    map, ’whereweare.png’, ’png’)
IRL example, part 2

coords = [(30.44, 50.455), (30.465, 50.459)]
coords = [mapnik.Coord(*coord)
          for coord in coords]
coords = [projection.forward(coord)
          for coord in coords]
bbox = mapnik.Envelope(*coords)
map.zoom_to_box(bbox)
mapnik.render_to_file(
    map, ’whereweare.png’, ’png’)
IRL example, part 2

coords = [(30.44, 50.455), (30.465, 50.459)]
coords = [mapnik.Coord(*coord)
          for coord in coords]
coords = [projection.forward(coord)
          for coord in coords]
bbox = mapnik.Envelope(*coords)
map.zoom_to_box(bbox)
mapnik.render_to_file(
    map, ’whereweare.png’, ’png’)
Styles are cool!
Outline

            Mapnik
            Other tools




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   18 / 23
bulk upload.py


        Mass imports of data
        Perfect overview of working with OSM
        API




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   19 / 23
PythonOsmApi


        Thin wrapper over HTTP OSM API
        Allows editing OSM data




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   20 / 23
CloudMade API



                           Shameless plug




Andrii V. Mishkovskyi ()    OpenStreetMap and Python   October 27, 2009   21 / 23
CloudMade API


        Access to CloudMade’s services
        Routing, geocoding, tiles . . .
        More coming soon




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   21 / 23
So. . .

         OpenStreetMap is the biggest data
         dump ever
         Mapnik rules
         APIs rule
         Lots of work yet to be done



 Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   22 / 23
Links

        osm.org
        mapnik.org
        cloudmade.com
        wiki.osm.org




Andrii V. Mishkovskyi ()   OpenStreetMap and Python   October 27, 2009   23 / 23

Mais conteúdo relacionado

Semelhante a It Jam 2009

Dmytro Safonov "Open-Source Map Viewers"
Dmytro Safonov  "Open-Source Map Viewers"Dmytro Safonov  "Open-Source Map Viewers"
Dmytro Safonov "Open-Source Map Viewers"LogeekNightUkraine
 
Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGISXander Bakker
 
도시건축설계와 오픈소스 기반 GIS
도시건축설계와 오픈소스 기반 GIS도시건축설계와 오픈소스 기반 GIS
도시건축설계와 오픈소스 기반 GISmac999
 
도시 설계와 GIS 기술의 관계
도시 설계와 GIS 기술의 관계도시 설계와 GIS 기술의 관계
도시 설계와 GIS 기술의 관계Tae wook kang
 
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...Rob Emanuele
 
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...Matthias Trapp
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsRoberto Casadei
 
Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityStavros Vassos
 
Lect 9 lab-1 intro to interface
Lect 9 lab-1 intro to interfaceLect 9 lab-1 intro to interface
Lect 9 lab-1 intro to interfaceRehana Jamal
 
Interactive Editing of Signed Distance Fields
Interactive Editing of Signed Distance FieldsInteractive Editing of Signed Distance Fields
Interactive Editing of Signed Distance FieldsMatthias Trapp
 
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHubEuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHubMartin Christen
 
Creating Custom Charts With Ruby Vector Graphics
Creating Custom Charts With Ruby Vector GraphicsCreating Custom Charts With Ruby Vector Graphics
Creating Custom Charts With Ruby Vector GraphicsDavid Keener
 
Hypergraph Mining For Social Networks
Hypergraph Mining For Social NetworksHypergraph Mining For Social Networks
Hypergraph Mining For Social NetworksGiacomo Bergami
 
Graph operations in Git version control system
Graph operations in Git version control systemGraph operations in Git version control system
Graph operations in Git version control systemJakub Narębski
 
GRASS and OSGeo: a framework for archeology
GRASS and OSGeo: a framework for archeologyGRASS and OSGeo: a framework for archeology
GRASS and OSGeo: a framework for archeologyMarkus Neteler
 
NASA Web World Wind: welcome to the new era of virtual globes
NASA Web World Wind: welcome to the new era of virtual globes NASA Web World Wind: welcome to the new era of virtual globes
NASA Web World Wind: welcome to the new era of virtual globes Maria Antonia Brovelli
 

Semelhante a It Jam 2009 (20)

Dmytro Safonov "Open-Source Map Viewers"
Dmytro Safonov  "Open-Source Map Viewers"Dmytro Safonov  "Open-Source Map Viewers"
Dmytro Safonov "Open-Source Map Viewers"
 
Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGIS
 
도시건축설계와 오픈소스 기반 GIS
도시건축설계와 오픈소스 기반 GIS도시건축설계와 오픈소스 기반 GIS
도시건축설계와 오픈소스 기반 GIS
 
도시 설계와 GIS 기술의 관계
도시 설계와 GIS 기술의 관계도시 설계와 GIS 기술의 관계
도시 설계와 GIS 기술의 관계
 
Python and GIS
Python and GISPython and GIS
Python and GIS
 
Presentation final 72
Presentation final 72Presentation final 72
Presentation final 72
 
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
 
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive Systems
 
Pathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in UnityPathfinding - Part 2: Examples in Unity
Pathfinding - Part 2: Examples in Unity
 
Lect 9 lab-1 intro to interface
Lect 9 lab-1 intro to interfaceLect 9 lab-1 intro to interface
Lect 9 lab-1 intro to interface
 
Things to do with OpenStreetMap
Things to do with OpenStreetMapThings to do with OpenStreetMap
Things to do with OpenStreetMap
 
Interactive Editing of Signed Distance Fields
Interactive Editing of Signed Distance FieldsInteractive Editing of Signed Distance Fields
Interactive Editing of Signed Distance Fields
 
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHubEuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
EuroPython 2019: GeoSpatial Analysis using Python and JupyterHub
 
Creating Custom Charts With Ruby Vector Graphics
Creating Custom Charts With Ruby Vector GraphicsCreating Custom Charts With Ruby Vector Graphics
Creating Custom Charts With Ruby Vector Graphics
 
Hypergraph Mining For Social Networks
Hypergraph Mining For Social NetworksHypergraph Mining For Social Networks
Hypergraph Mining For Social Networks
 
Graph operations in Git version control system
Graph operations in Git version control systemGraph operations in Git version control system
Graph operations in Git version control system
 
GRASS and OSGeo: a framework for archeology
GRASS and OSGeo: a framework for archeologyGRASS and OSGeo: a framework for archeology
GRASS and OSGeo: a framework for archeology
 
Ocul help guides_2011
Ocul help guides_2011Ocul help guides_2011
Ocul help guides_2011
 
NASA Web World Wind: welcome to the new era of virtual globes
NASA Web World Wind: welcome to the new era of virtual globes NASA Web World Wind: welcome to the new era of virtual globes
NASA Web World Wind: welcome to the new era of virtual globes
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

It Jam 2009

  • 1. OpenStreetMap and Python Andrii V. Mishkovskyi October 27, 2009 Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 1 / 23
  • 2. What is OpenStreetMap? In short: The Wikipedia of Maps Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 2 / 23
  • 3. What is OpenStreetMap? Free CC-by-SA Constantly evolving Easy to start Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 3 / 23
  • 4. Languages used Ruby site C++ rendering, editors, utilities Python rendering, utilities Java utilities, editors PHP wiki Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 4 / 23
  • 5. Python tools bulk upload.py PythonOsmApi CloudMade’s Python API Mapnik Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 5 / 23
  • 6. Outline Mapnik Other tools Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 6 / 23
  • 7. Overview Render tool Written in C++ Boost.Python for bindings Lots of input plugins PNG, JPG, SVG, PDF output Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 7 / 23
  • 8. Example, part 1 import mapnik map = mapnik.Map() map.background = mapnik.Color(’steelblue’) rule = mapnik.Rule() rule.symbols.append( mapnik.PolygonSymbolizer( mapnik.Color(’#f2eff9’))) rule.symbols.append( mapnik.LineSymbolizer( mapnik.Color(’rgb(50%,50%,50%)’), 0.1)) style = mapnik.Style() style.rules.append(rule) map.append_style(’Base’, style)
  • 9. Example, part 1 import mapnik map = mapnik.Map() map.background = mapnik.Color(’steelblue’) rule = mapnik.Rule() rule.symbols.append( mapnik.PolygonSymbolizer( mapnik.Color(’#f2eff9’))) rule.symbols.append( mapnik.LineSymbolizer( mapnik.Color(’rgb(50%,50%,50%)’), 0.1)) style = mapnik.Style() style.rules.append(rule) map.append_style(’Base’, style)
  • 10. Example, part 1 import mapnik map = mapnik.Map() map.background = mapnik.Color(’steelblue’) rule = mapnik.Rule() rule.symbols.append( mapnik.PolygonSymbolizer( mapnik.Color(’#f2eff9’))) rule.symbols.append( mapnik.LineSymbolizer( mapnik.Color(’rgb(50%,50%,50%)’), 0.1)) style = mapnik.Style() style.rules.append(rule) map.append_style(’Base’, style)
  • 11. Example, part 1 import mapnik map = mapnik.Map() map.background = mapnik.Color(’steelblue’) rule = mapnik.Rule() rule.symbols.append( mapnik.PolygonSymbolizer( mapnik.Color(’#f2eff9’))) rule.symbols.append( mapnik.LineSymbolizer( mapnik.Color(’rgb(50%,50%,50%)’), 0.1)) style = mapnik.Style() style.rules.append(rule) map.append_style(’Base’, style)
  • 12. Example, part 2 layer = mapnik.Layer(’world’, "+proj=latlong +datum=WGS84") layer.datasource = mapnik.Shapefile( file=’boundaries.shp’) layer.styles.append(’Base’) map.layers.append(layer) map.zoom_to_box(layer.envelope()) mapnik.render_to_file(map, ’world.png’, ’png’)
  • 13. Example, part 2 layer = mapnik.Layer(’world’, "+proj=latlong +datum=WGS84") layer.datasource = mapnik.Shapefile( file=’boundaries.shp’) layer.styles.append(’Base’) map.layers.append(layer) map.zoom_to_box(layer.envelope()) mapnik.render_to_file(map, ’world.png’, ’png’)
  • 14. Example, part 2 layer = mapnik.Layer(’world’, "+proj=latlong +datum=WGS84") layer.datasource = mapnik.Shapefile( file=’boundaries.shp’) layer.styles.append(’Base’) map.layers.append(layer) map.zoom_to_box(layer.envelope()) mapnik.render_to_file(map, ’world.png’, ’png’)
  • 15. Example, part 2 layer = mapnik.Layer(’world’, "+proj=latlong +datum=WGS84") layer.datasource = mapnik.Shapefile( file=’boundaries.shp’) layer.styles.append(’Base’) map.layers.append(layer) map.zoom_to_box(layer.envelope()) mapnik.render_to_file(map, ’world.png’, ’png’)
  • 17.
  • 19. IRL example, part 1 import mapnik projection = mapnik.Projection( "+proj=merc +a=6378137 +b=6378137 " "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 " "+no_defs +over +lat_ts=0.0 +units=m") map = mapnik.Map(900, 600) mapnik.load_map(map, ’/path/to/style.xml’)
  • 20. IRL example, part 1 import mapnik projection = mapnik.Projection( "+proj=merc +a=6378137 +b=6378137 " "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 " "+no_defs +over +lat_ts=0.0 +units=m") map = mapnik.Map(900, 600) mapnik.load_map(map, ’/path/to/style.xml’)
  • 21. IRL example, part 1 import mapnik projection = mapnik.Projection( "+proj=merc +a=6378137 +b=6378137 " "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 " "+no_defs +over +lat_ts=0.0 +units=m") map = mapnik.Map(900, 600) mapnik.load_map(map, ’/path/to/style.xml’)
  • 22. IRL example, part 1 import mapnik projection = mapnik.Projection( "+proj=merc +a=6378137 +b=6378137 " "+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 " "+no_defs +over +lat_ts=0.0 +units=m") map = mapnik.Map(900, 600) mapnik.load_map(map, ’/path/to/style.xml’)
  • 23. IRL example, part 2 coords = [(30.44, 50.455), (30.465, 50.459)] coords = [mapnik.Coord(*coord) for coord in coords] coords = [projection.forward(coord) for coord in coords] bbox = mapnik.Envelope(*coords) map.zoom_to_box(bbox) mapnik.render_to_file( map, ’whereweare.png’, ’png’)
  • 24. IRL example, part 2 coords = [(30.44, 50.455), (30.465, 50.459)] coords = [mapnik.Coord(*coord) for coord in coords] coords = [projection.forward(coord) for coord in coords] bbox = mapnik.Envelope(*coords) map.zoom_to_box(bbox) mapnik.render_to_file( map, ’whereweare.png’, ’png’)
  • 25. IRL example, part 2 coords = [(30.44, 50.455), (30.465, 50.459)] coords = [mapnik.Coord(*coord) for coord in coords] coords = [projection.forward(coord) for coord in coords] bbox = mapnik.Envelope(*coords) map.zoom_to_box(bbox) mapnik.render_to_file( map, ’whereweare.png’, ’png’)
  • 26.
  • 27.
  • 29. Outline Mapnik Other tools Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 18 / 23
  • 30. bulk upload.py Mass imports of data Perfect overview of working with OSM API Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 19 / 23
  • 31. PythonOsmApi Thin wrapper over HTTP OSM API Allows editing OSM data Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 20 / 23
  • 32. CloudMade API Shameless plug Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 21 / 23
  • 33. CloudMade API Access to CloudMade’s services Routing, geocoding, tiles . . . More coming soon Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 21 / 23
  • 34. So. . . OpenStreetMap is the biggest data dump ever Mapnik rules APIs rule Lots of work yet to be done Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 22 / 23
  • 35. Links osm.org mapnik.org cloudmade.com wiki.osm.org Andrii V. Mishkovskyi () OpenStreetMap and Python October 27, 2009 23 / 23