OpenStreetMaps has become an impressive geographical database which can be considered as “the Wikipedia of maps”. OSM opens a very interesting door for the derivation of specialized layers (not only roads but also railways, shops, protected areas, etc) which can be used for spatial analysis, filling an important gap in the Open Data field.
Till recently, export options where rather limited, mainly involving using XAPI (a read-only web interface for OSM data), or creating a kind of replica of OSM database in PostGIS. Fortunately, more options are available now such as the simpler and powerful Overpass API, which together with the Overpass Turbo service are lowering the entry barrier for exporting data.
However, if you need to export a very big amount of data (such as the roads for a full continent), you will still need to configure a local replica of OSM data, otherwise you will be banned by on-line services. There are several options when building that replica, each of it best suited for a different purpose, as summarized in the following table:
|Schema name||Created with||Used by||Primary use case||Geometries (PostGIS)?||Database|
|osm2pgsql||osm2pgsql||Mapnik, Kothic JS||Rendering||Yes||PostgreSQL|
The original, complete table can be found in OSM Wiki. Consider carefully the features offered by each option (and its space requirements) before selection any of them.
The ones I am familiar with are the pg_spapshot schema and the overpass schema. The pg_snapshot schema is a very good option if you prefer to query and post-process your data using SQL/PostGIS predicates. The full OSM database uses about 400 GB when imported in this schema. You can find the installation instructions in this tutorial. The overpass schema is suitable if you prefer to filter OSM data using a simple OSM-centric XML query language. In this case, the full planet requires about 150 GB (50 GB if excluding updates and metadata), and installation is quite easy if you are familiar with a Linux environment (a similar tutorial is available on overpassapi.de website) .