SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
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

Más contenido relacionado

Similar 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
 

Similar 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

TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101vincent683379
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPTiSEO AI
 

Último (20)

TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 

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