SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Dernier (20)

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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

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