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

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

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