Workshop/Seminar (~1 hr) Consuming OpenStreetMap Data in an Open Source GIS Michael Markieta <[email protected]> Geographic Analysis – Ryerson University Provided under CC-BY-SA 3.0 . Please leave the attribution in tact but feel free to alter this work.
10
Embed
Ryerson University OpenStreetMap Hack Weekend Workshop on Using OSM Data in open source GIS
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Workshop/Seminar (~1 hr)
Consuming OpenStreetMap Data in an Open Source GIS
Michael Markieta <[email protected]>Geographic Analysis – Ryerson University
Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
Ubuntu 12.10 CLI● Working with the toronto.osm.gz extract from bbbike.org● Populate the database with the Toronto.osm extract
sudo su postgresosm2pgsql -s -U postgres -d OSM -W -E 'EPSG:4326' -G Toronto.osm
● What does this do exactly?
osm2pgsql : the script that parses the toronto.osm file into the database-s : run in slim mode (to reduce RAM usage incase we don't have enough)-U postgres : database username-d OSM : database name-W : force password prompt-E 'EPSG:4326' : coordinate system used to store the data (WGS84)-G : generate multi-geometry (multi-point, multi-line, multi-polygon)
● That's it! About 12 lines of code and we have put the latest data from OpenStreetMap for Toronto into our database, ready to be queried.
Using QGIS to access the data
● Data stored as:
planet_osm_pointplanet_osm_lineplanet_osm_polygon
● Example query in SQL
select * from planet_osm_point where “amenity”='cafe';
● QGIS Query Builder
“amenity” = 'cafe'
Try it out on your own machine!
VMWare Virtual Machine running Ubuntu 12.10
QGIS File : “~/desktop/Toronto Demo.qgs”Database : OSM <localhost postgres:workshop>