-
Notifications
You must be signed in to change notification settings - Fork 18
import
initdb
will initialize postgres, create the database, add PostGIS and spatial-reference systems, create a required user and install server certificates:
$ docker-compose run osm initdb
OpenStreetMap data must be imported into the Postgres database.
-
choose a mirror from http://wiki.openstreetmap.org/wiki/Planet.osm
-
Download
planet-latest.osm.pbf
orplanet-latest.osm.bz2
-
PBF format is recommended
- smaller file size than
bzip
d OSM XML files (.osm.bz2
)
- smaller file size than
-
Verify file integrity by calculating the
md5sum
and compare it w/ the value in the respective.md5
value
-
$ curl -O http://mirror2.shellbot.com/osm/planet-latest.osm.pbf.md5 $ md5sum -c planet-latest.osm.pbf.md5
### Import Data
Importing **OSM** data is performed by the `import` command.
Caching can improve the performance of `import`. Cache is configured via the `OSM_IMPORT_CACHE` environment variable <sup>[1](#environment-variables)</sup>. The value is specified in units of `MB`, and values between 15-80% of available memory are recommended, but should take into consideration usage by other applications on the system. Specifying more memory than the system has available will result in an error. For further details, see:
- <http://wiki.openstreetmap.org/wiki/Osm2pgsql#Parameters>
- <https://github.com/openstreetmap/osm2pgsql/blob/master/options.cpp>
To import data, run the `import` function:
```sh
$ docker-compose run osm import
Environment variables are set under the environment
key of docker-compose.yml
; for further details re: managing environment variables w/ Docker Compose, see the official documentation.