-
Notifications
You must be signed in to change notification settings - Fork 41
Importing data
Daniele Santini edited this page Jan 19, 2019
·
7 revisions
You need osm2pgsql, PostgreSQL and PostGIS installed.
Install scripts also need: bash, wget, unzip, gdal, shapeindex (in mapnik-utils)
sudo apt install postgresql-client-9.3 postgresql-9.3-postgis-2.1 osm2pgsql
sudo apt install postgresql-client-9.4 postgresql-9.4-postgis-2.1 osm2pgsql
sudo dnf install osm2pgsql postgresql-contrib postgis gdal mapnik-utils
sudo postgresql-setup --initdb
sudo systemctl start postgresql.service
If you don't have a user yet, create one:
sudo -u postgres createuser {youruser}
Then create the db (we are using hdm
as name, but you can use
what you want):
sudo -u postgres createdb hdm -O {youruser}
Activate postgis and hstore extensions:
sudo -u postgres psql hdm
hdm=# CREATE EXTENSION postgis;
hdm=# CREATE EXTENSION hstore;
Get the data of the area you want, from one of those sites:
You need to download the .osm.pbf
file of the area you want. For
example, for Burundi, we use http://download.openstreetmap.fr/extracts/africa/burundi.osm.pbf
osm2pgsql -G -U {youruser} -d hdm path/to/file-latest.osm.pbf --hstore --create