1 Importing a new database
2 ========================
4 The following instructions explain how to create a Nominatim database
5 from an OSM planet file and how to keep the database up to date. It
6 is assumed that you have already sucessfully installed the Nominatim
7 software itself, if not return to the [prerequisites page](Prerequisites.md).
9 Configuration setup in settings/local.php
10 -----------------------------------------
12 There are lots of configuration settings you can tweak. Have a look
13 at `settings/settings.php` for a full list. Most should have a sensible default.
14 If you plan to import a large dataset (e.g. Europe, North America, planet),
15 you should also enable flatnode storage of node locations. With this
16 setting enabled, node coordinates are stored in a simple file instead
17 of the database. This will save you import time and disk storage.
18 Add to your settings/local.php:
20 @define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file');
23 Downloading additional data
24 ---------------------------
26 ### Wikipedia rankings
28 Wikipedia can be used as an optional auxiliary data source to help indicate
29 the importance of osm features. Nominatim will work without this information
30 but it will improve the quality of the results if this is installed.
31 This data is available as a binary download:
33 cd $NOMINATIM_SOURCE_DIR/data
34 wget http://www.nominatim.org/data/wikipedia_article.sql.bin
35 wget http://www.nominatim.org/data/wikipedia_redirect.sql.bin
37 Combined the 2 files are around 1.5GB and add around 30GB to the install
38 size of nominatim. They also increase the install time by an hour or so.
42 Nominatim can use postcodes from an external source to improve searches that involve a UK postcode. This data can be optionally downloaded:
44 cd $NOMINATIM_SOURCE_DIR/data
45 wget http://www.nominatim.org/data/gb_postcode_data.sql.gz
48 Initial Import of the Data
49 --------------------------
51 **Important:** first try the import with a small excerpt, for example from Geofabrik.
53 Download the data to import and load the data with the following command:
55 ./utils/setup.php --osm-file <your data file> --all [--osm2pgsql-cache 28000] 2>&1 | tee setup.log
57 The --osm2pgsql-cache parameter is optional but strongly recommended for
58 planet imports. It sets the node cache size for the osm2pgsql import part
59 (see -C parameter in osm2pgsql help). 28GB are recommended for a full planet
60 imports, for excerpts you can use less.
61 Adapt to your available RAM to avoid swapping.
63 The import will take as little as an hour for a small country extract
64 and as much as 10 days for a full-scale planet import on less powerful
68 Loading Additional Datasets
69 ---------------------------
71 The following commands will create additional entries for countries and POI searches:
73 ./utils/specialphrases.php --countries > data/specialphrases_countries.sql
74 psql -d nominatim -f data/specialphrases_countries.sql
75 ./utils/specialphrases.php --wiki-import > data/specialphrases.sql
76 psql -d nominatim -f data/specialphrases.sql