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
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
0 comments
Post a comment