[[GlossaryDefinition::1. OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world. The creation and growth of OSM has been motivated by restrictions on use or availability of map information across much of the world, and the advent of inexpensive portable satellite navigation devices. OSM is considered a prominent example of volunteered geographic information.]]
OSM in oedb
OSM can be imported in PostgreSQL.
The oedb has the schema openstreetmap.
All keys and tags are stored in the tags
column with format hstore
To query hstore is different but simple:
SELECT * FROM openstreetmap.osm_deu_point WHERE tags ? 'research_institution'
SELECT tags -> 'name' AS name, tags -> 'short_name' AS abbreviation FROM openstreetmap.osm_deu_point WHERE tags @> '"amenity"=>"research_institute"'
The import is done with osm2pgsql, oedb.style and setup_openstreetmap.sql
When importing OSM data this way, the tables osm_deu_line and osm_deu_roads are created among others. Osm_deu_line contains every imported line object. Osm_deu_roads does NOT contain only roads, but is a subset of osm_deu_line, which in other applications can be used for simplified map visualisation at higher zoom levels. It is not suitable for data processing purposes because of incompleteness of the data.
A subset of osm_deu_line which contains only roads can be created by using the highway-key as follows:
SELECT * FROM openstreetmap.osm_deu_line
WHERE "highway" = 'motorway' OR "highway" = 'trunk' OR "highway" = 'primary' OR "highway" = 'secondary'
OR "highway" = 'tertiary' OR "highway" = 'unclassified' OR "highway" = 'residential' OR "highway" = 'service'
OR "highway" = 'living_street' OR "highway" = 'pedestrian' OR "highway" = 'bus_guideway' OR "highway" = 'road'
OR "highway" = 'motorway_link' OR "highway" = 'trunk_link' OR "highway" = 'primary_link'
OR "highway" = 'secondary_link' OR "highway" = 'tertiary_link' OR "highway" = 'track'
Download of OSM data
Small chunks off OSM data can be downloaded using QGIS. Under Vektor --> OpenstreetMap --> Daten herunterladen a .osm-file covering the current screen size can be downloaded.
OSM data for whole regions is available under http://download.geofabrik.de/