Workshop/Seminar (~1 hr)Consuming OpenStreetMap Data in anOpen Source GISMichael Markieta <michael@spatialanalysis.ca>Geog...
Now that we know all about OpenStreetMap●How should we consume OSM data?– Data Formats●xml, shp, kml, etc...– Methods●CLI ...
Where can I download OSM data?●Variety of mirrors that specialize in:– Areas of the “planet” or the “planet” itself– Updat...
Choosing an appropriate data format●Depends on:– size– intent– skills– wants/needs●Balancing act!– No need for a full blow...
Selecting an extract formatAny GIS Software will open a “shapefile”.osm files for database imports
Methods (briefly)
Ubuntu 12.10 CLI●Working with the Toronto.osm.gz extract from bbbike.org●Add repositories, update, upgrade and install eve...
Ubuntu 12.10 CLI●Working with the toronto.osm.gz extract from bbbike.org●Populate the database with the Toronto.osm extrac...
Using QGIS to access the data● Data stored as:planet_osm_pointplanet_osm_lineplanet_osm_polygon● Example query in SQLselec...
Try it out on your own machine!VMWare Virtual Machine running Ubuntu 12.10QGIS File : “~/desktop/Toronto Demo.qgs”Database...
Upcoming SlideShare
Loading in …5
×

Ryerson University OpenStreetMap Hack Weekend Workshop on Using OSM Data in open source GIS

1,027 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,027
On SlideShare
0
From Embeds
0
Number of Embeds
22
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Provided under CC-BY-SA 3.0 . Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0 . Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0 . Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0 . Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
  • Provided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
  • Ryerson University OpenStreetMap Hack Weekend Workshop on Using OSM Data in open source GIS

    1. 1. Workshop/Seminar (~1 hr)Consuming OpenStreetMap Data in anOpen Source GISMichael Markieta <michael@spatialanalysis.ca>Geographic Analysis – Ryerson UniversityProvided under CC-BY-SA 3.0. Please leave the attribution in tact but feel free to alter this work.
    2. 2. Now that we know all about OpenStreetMap●How should we consume OSM data?– Data Formats●xml, shp, kml, etc...– Methods●CLI tools, QGIS Plugins, ArcMap Extensions, etc...– Performance●Mix of robustness, efficiency and ease of use
    3. 3. Where can I download OSM data?●Variety of mirrors that specialize in:– Areas of the “planet” or the “planet” itself– Update schedule (monthly, weekly, daily, etc...)– Diffs (for tracking changes)●List of current “planet” mirrors:http://wiki.openstreetmap.org/wiki/Planet.osm– We can use this list to find extracts of smaller areas aswell (e.g.: City of Toronto, Melbourne, etc...)
    4. 4. Choosing an appropriate data format●Depends on:– size– intent– skills– wants/needs●Balancing act!– No need for a full blown databasewhen all you need is a snapshotof the Ryerson Campus buildings●Lets take a look at what kind of data is available here:http://download.bbbike.org/osm/bbbike/0510
    5. 5. Selecting an extract formatAny GIS Software will open a “shapefile”.osm files for database imports
    6. 6. Methods (briefly)
    7. 7. Ubuntu 12.10 CLI●Working with the Toronto.osm.gz extract from bbbike.org●Add repositories, update, upgrade and install everything we needsudo add-apt-repository ppa:ubuntugis/ubuntugis-unstablesudo add-apt-repository ppa:kakrueger/openstreetmapsudo apt-get updatesudo apt-get upgradesudo apt-get install qgis osm2pgsql●osm2pgsql will ask to automically create and configure a database, sounds good!Give the postgres user a password:sudo -u postgres psql postgrespassword postgres●Just for referencedbname=OSM username=postgres password=workshop●Add the PostGIS extension to our databasesudo su postgrespsql -U postgres OSMCREATE EXTENSION postgis;●Download Toronto.osm.gz and unpack it (.gz means its compressed)wget http://download.bbbike.org/osm/bbbike/Toronto/Toronto.osm.gz && gunzip Toronto.osm.gz
    8. 8. Ubuntu 12.10 CLI●Working with the toronto.osm.gz extract from bbbike.org●Populate the database with the Toronto.osm extractsudo 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 dont 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)●Thats it! About 12 lines of code and we have put the latest data fromOpenStreetMap for Toronto into our database, ready to be queried.
    9. 9. Using QGIS to access the data● Data stored as:planet_osm_pointplanet_osm_lineplanet_osm_polygon● Example query in SQLselect * from planet_osm_point where “amenity”=cafe;● QGIS Query Builder“amenity” = cafe
    10. 10. Try it out on your own machine!VMWare Virtual Machine running Ubuntu 12.10QGIS File : “~/desktop/Toronto Demo.qgs”Database : OSM <localhost postgres:workshop>Data : TorontoQGIS File : “~/desktop/Melbourne Demo.qgs”Database : OSM2 <localhost postgres:workshop>Data : Melbourne

    ×