28. July 2014
In this post I’ll show how to explore (or data mine) Open Street Map data and use features off-line that normally can be hard to get.
Many use http://download.geofabrik.de to download zipped shapefiles to be used directly in GIS systems, but are surprised when it does not contain as much data as the same area in Open Street Map on-line.
You can still use geofabrik.de but download the *.osm.bz2 files instead. They include raw data from OSM that needs to be processed in order to be used in QGIS or other GIS applications.
In QGIS there’s a tool in the Vector menu called OpenStreetMap that can download and process small areas with OSM data, but for data covering a whole state or nation it doesn’t work. The tools for “Import” and “Export” of topology however, does work.
Data above is from gadm.org.
To exemplify I’m downloading data covering Israel and Palestine, partly because I want to know more about the geography, but also because there are a lot of confusing (for me) symbols that are not explained (link) in Open Street Map.
After downloading and extracting the Israel-and-Palestine.osm.bz2 file I use QGIS to import topology from the *.osm file.
The next step is to “Export” the topology for points, lines and surfaces to a SpatiaLite database. This is done with the third option in the Vector – OpenStreetMap menu.
The tool can only “export” topology for one geometry type at a time, so you may need to run this tool many times to import everything you need.
In my example here I’ll skip the creation of attributes since I’ll use the data in another way but if you want to use the attributes you will need to use the “Load from DB” button and select the attributes you want to add (there’s a lot of them).
The completed import/export gives me a lot of points, lines and polygons as well as some not entirely useful tables (picture above).
Now its time for the magic.
For each layer I create an “action” under the respective layer properties.
Picture above shows action for point layer.
All actions are of type “Open” and the action for the point layer is:
http://www.openstreetmap.org/node/[% "id" %]
And for lines and polygons:
http://www.openstreetmap.org/way/[% "id" %]
When I now use the “Run feature action” tool on either the point, line or polygon layer, I get a web page with the feature highlighted and explained with all available data.
In this view I can see that the mosque is of Sunni denomination.
It’s also possible to find objects that is not visible in the “official” Open Street Map this way.
Like the “Bait Iksa Council” building above, or the “Ajaj Taxi” below.
Now I have a useful tool to dig deeper into the Israel – Palestine conflict, at least geographically.
Some caution though. Anyone can edit Open Street Map, and no one is obliged to do so. Therefore it’s much like Wikipedia and you need to be critical to any and all information you find. It can be helpful to trace edits of a certain feature to see if there are difference of opinion.
The method described here will help you do exactly that.