Skip to content
Erik Johnson edited this page Mar 28, 2016 · 6 revisions

OSM Tiles: Import

Initialize database

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

OSM-Data Import

OpenStreetMap data must be imported into the Postgres database.

Download Latest OSM Data

$ 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
## [1] Environment Variables

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.


« Previous: Prerequisites | Home | Next: Render »

Clone this wiki locally