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

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Dernier (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

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