Database Reference
In-Depth Information
$ osm2pgsql
osm2pgsql SVN version 0.80.0 (32bit id
space)
4. We will create a different database only for this recipe, as we will use this
OSM database in other chapters. For this purpose, create a new database
named
rome
and assign privileges to your user:
postgres=# CREATE DATABASE rome OWNER me;
postgres=# \connect rome;
rome=# create extension postgis;
5. You will not create a different schema in this new database, though, as the
osm2pgsql
commandcanonlyimportOSMdatainthepublicschemaatthe
time of writing.
6. BesurethatyourPostgreSQLinstallationsupports
hstore
.Ifnot,download
andinstallit;forexample,inDebian-basedLinuxdistributions,youwillneed
toinstallthe
postgresql-contrib-9.1
package.Then,addthe
hstore
support to the
rome
database using the
CREATE EXTENSION
syntax:
$ sudo apt-get update
$ sudo apt-get install
postgresql-contrib-9.1
$ psql -U me -d romerome=# CREATE
EXTENSION hstore;
How to do it...
The steps you need to follow to complete this recipe are as follows:
1. Go to the
openstreetmap.org
website.
2. Select the area of interest for which you want to export data. You
shouldnotselectalargearea,astheliveexportfromthewebsiteis
limited to 50,000 nodes.