forked from hans/Nominatim
updates to admin and develop documentation
Mostly minor updates in wording and resource consumption.
This commit is contained in:
@@ -29,7 +29,7 @@ Add to your `settings/local.php`:
|
|||||||
@define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file');
|
@define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file');
|
||||||
|
|
||||||
Replace the second part with a suitable path on your system and make sure
|
Replace the second part with a suitable path on your system and make sure
|
||||||
the directory exists. There should be at least 64GB of free space.
|
the directory exists. There should be at least 75GB of free space.
|
||||||
|
|
||||||
## Downloading additional data
|
## Downloading additional data
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ This data is available as a binary download:
|
|||||||
cd $NOMINATIM_SOURCE_DIR/data
|
cd $NOMINATIM_SOURCE_DIR/data
|
||||||
wget https://www.nominatim.org/data/wikimedia-importance.sql.gz
|
wget https://www.nominatim.org/data/wikimedia-importance.sql.gz
|
||||||
|
|
||||||
The file is about 400MB and adds around 4GB to Nominatim database.
|
The file is about 400MB and adds around 4GB to the Nominatim database.
|
||||||
|
|
||||||
!!! tip
|
!!! tip
|
||||||
If you forgot to download the wikipedia rankings, you can also add
|
If you forgot to download the wikipedia rankings, you can also add
|
||||||
@@ -60,7 +60,7 @@ involve a GB or US postcode. This data can be optionally downloaded:
|
|||||||
wget https://www.nominatim.org/data/gb_postcode_data.sql.gz
|
wget https://www.nominatim.org/data/gb_postcode_data.sql.gz
|
||||||
wget https://www.nominatim.org/data/us_postcode_data.sql.gz
|
wget https://www.nominatim.org/data/us_postcode_data.sql.gz
|
||||||
|
|
||||||
## Choosing the Data to Import
|
## Choosing the data to import
|
||||||
|
|
||||||
In its default setup Nominatim is configured to import the full OSM data
|
In its default setup Nominatim is configured to import the full OSM data
|
||||||
set for the entire planet. Such a setup requires a powerful machine with
|
set for the entire planet. Such a setup requires a powerful machine with
|
||||||
@@ -70,11 +70,11 @@ section discusses these methods. They can also be combined.
|
|||||||
|
|
||||||
### Using an extract
|
### Using an extract
|
||||||
|
|
||||||
If you only need geocoding for a smaller region, then precomputed extracts
|
If you only need geocoding for a smaller region, then precomputed OSM extracts
|
||||||
are a good way to reduce the database size and import time.
|
are a good way to reduce the database size and import time.
|
||||||
[Geofabrik](https://download.geofabrik.de) offers extracts for most countries.
|
[Geofabrik](https://download.geofabrik.de) offers extracts for most countries.
|
||||||
They even have daily updates which can be used with the update process described
|
They even have daily updates which can be used with the update process described
|
||||||
below. There are also
|
[in the next section](../Update). There are also
|
||||||
[other providers for extracts](https://wiki.openstreetmap.org/wiki/Planet.osm#Downloading).
|
[other providers for extracts](https://wiki.openstreetmap.org/wiki/Planet.osm#Downloading).
|
||||||
|
|
||||||
Please be aware that some extracts are not cut exactly along the country
|
Please be aware that some extracts are not cut exactly along the country
|
||||||
@@ -128,21 +128,23 @@ The style can be changed with the configuration `CONST_Import_Style`.
|
|||||||
|
|
||||||
To give you an idea of the impact of using the different styles, the table
|
To give you an idea of the impact of using the different styles, the table
|
||||||
below gives rough estimates of the final database size after import of a
|
below gives rough estimates of the final database size after import of a
|
||||||
2018 planet and after using the `--drop` option. It also shows the time
|
2020 planet and after using the `--drop` option. It also shows the time
|
||||||
needed for the import on a machine with 64GB RAM, 4 CPUS and SSDs. Note that
|
needed for the import on a machine with 64GB RAM, 4 CPUS and NVME disks.
|
||||||
the given sizes are just an estimate meant for comparison of style requirements.
|
Note that the given sizes are just an estimate meant for comparison of
|
||||||
Your planet import is likely to be larger as the OSM data grows with time.
|
style requirements. Your planet import is likely to be larger as the
|
||||||
|
OSM data grows with time.
|
||||||
|
|
||||||
style | Import time | DB size | after drop
|
style | Import time | DB size | after drop
|
||||||
----------|--------------|------------|------------
|
----------|--------------|------------|------------
|
||||||
admin | 5h | 190 GB | 20 GB
|
admin | 4h | 215 GB | 20 GB
|
||||||
street | 42h | 400 GB | 180 GB
|
street | 42h | 400 GB | 180 GB
|
||||||
address | 59h | 500 GB | 260 GB
|
address | 59h | 500 GB | 260 GB
|
||||||
full | 80h | 575 GB | 300 GB
|
full | 80h | 575 GB | 300 GB
|
||||||
extratags | 80h | 585 GB | 310 GB
|
extratags | 80h | 585 GB | 310 GB
|
||||||
|
|
||||||
You can also customize the styles further. For a description of the
|
You can also customize the styles further.
|
||||||
style format see [the development section](../develop/Import.md).
|
A [description of the style format](../develop/Import.md#configuring-the-import)
|
||||||
|
can be found in the development section.
|
||||||
|
|
||||||
## Initial import of the data
|
## Initial import of the data
|
||||||
|
|
||||||
@@ -150,15 +152,17 @@ style format see [the development section](../develop/Import.md).
|
|||||||
First try the import with a small extract, for example from
|
First try the import with a small extract, for example from
|
||||||
[Geofabrik](https://download.geofabrik.de).
|
[Geofabrik](https://download.geofabrik.de).
|
||||||
|
|
||||||
Download the data to import and load the data with the following command
|
Download the data to import. Then issue the following command
|
||||||
from the build directory:
|
from the **build directory** to start the import:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./utils/setup.php --osm-file <data file> --all 2>&1 | tee setup.log
|
./utils/setup.php --osm-file <data file> --all 2>&1 | tee setup.log
|
||||||
```
|
```
|
||||||
|
|
||||||
***Note for full planet imports:*** Even on a perfectly configured machine
|
### Notes on full planet imports
|
||||||
the import of a full planet takes at least 2 days. Once you see messages
|
|
||||||
|
Even on a perfectly configured machine
|
||||||
|
the import of a full planet takes around 2 days. Once you see messages
|
||||||
with `Rank .. ETA` appear, the indexing process has started. This part takes
|
with `Rank .. ETA` appear, the indexing process has started. This part takes
|
||||||
the most time. There are 30 ranks to process. Rank 26 and 30 are the most complex.
|
the most time. There are 30 ranks to process. Rank 26 and 30 are the most complex.
|
||||||
They take each about a third of the total import time. If you have not reached
|
They take each about a third of the total import time. If you have not reached
|
||||||
@@ -167,11 +171,12 @@ configuration as it may not be optimal for the import.
|
|||||||
|
|
||||||
### Notes on memory usage
|
### Notes on memory usage
|
||||||
|
|
||||||
In the first step of the import Nominatim uses osm2pgsql to load the OSM data
|
In the first step of the import Nominatim uses [osm2pgsql](https://osm2pgsql.org)
|
||||||
into the PostgreSQL database. This step is very demanding in terms of RAM usage.
|
to load the OSM data into the PostgreSQL database. This step is very demanding
|
||||||
osm2pgsql and PostgreSQL are running in parallel at this point. PostgreSQL
|
in terms of RAM usage. osm2pgsql and PostgreSQL are running in parallel at
|
||||||
blocks at least the part of RAM that has been configured with the
|
this point. PostgreSQL blocks at least the part of RAM that has been configured
|
||||||
`shared_buffers` parameter during [PostgreSQL tuning](Installation#postgresql-tuning)
|
with the `shared_buffers` parameter during
|
||||||
|
[PostgreSQL tuning](Installation#postgresql-tuning)
|
||||||
and needs some memory on top of that. osm2pgsql needs at least 2GB of RAM for
|
and needs some memory on top of that. osm2pgsql needs at least 2GB of RAM for
|
||||||
its internal data structures, potentially more when it has to process very large
|
its internal data structures, potentially more when it has to process very large
|
||||||
relations. In addition it needs to maintain a cache for node locations. The size
|
relations. In addition it needs to maintain a cache for node locations. The size
|
||||||
@@ -182,10 +187,10 @@ completely and leave the memory for the flatnode file. Nominatim will do this
|
|||||||
by default, so you do not need to configure anything in this case.
|
by default, so you do not need to configure anything in this case.
|
||||||
|
|
||||||
For imports without a flatnode file, set `--osm2pgsql-cache` approximately to
|
For imports without a flatnode file, set `--osm2pgsql-cache` approximately to
|
||||||
the size of the OSM pbf file (in MB) you are importing. Make sure you leave
|
the size of the OSM pbf file you are importing. The size needs to be given in
|
||||||
enough RAM for PostgreSQL and osm2pgsql as mentioned above. If the system starts
|
MB. Make sure you leave enough RAM for PostgreSQL and osm2pgsql as mentioned
|
||||||
swapping or you are getting out-of-memory errors, reduce the cache size or
|
above. If the system starts swapping or you are getting out-of-memory errors,
|
||||||
even consider using a flatnode file.
|
reduce the cache size or even consider using a flatnode file.
|
||||||
|
|
||||||
### Verify the import
|
### Verify the import
|
||||||
|
|
||||||
@@ -197,7 +202,7 @@ Run this script to verify all required tables and indices got created successful
|
|||||||
|
|
||||||
### Setting up the website
|
### Setting up the website
|
||||||
|
|
||||||
Run the following command to set up the configuration file for the website
|
Run the following command to set up the configuration file for the API frontend
|
||||||
`settings/settings-frontend.php`. These settings are used in website/*.php files.
|
`settings/settings-frontend.php`. These settings are used in website/*.php files.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ Clone the source from github:
|
|||||||
|
|
||||||
git clone https://github.com/osm-search/nominatim-ui
|
git clone https://github.com/osm-search/nominatim-ui
|
||||||
|
|
||||||
Adapt the configuration `dist/config.js` to your needs. You need at least
|
Copy the example configuration into the right place:
|
||||||
|
|
||||||
|
cd nominatim-ui
|
||||||
|
cp dist/config.example.js dist/config.js
|
||||||
|
|
||||||
|
Now adapt the configuration to your needs. You need at least
|
||||||
to change the `Nominatim_API_Endpoint` to point to your Nominatim installation.
|
to change the `Nominatim_API_Endpoint` to point to your Nominatim installation.
|
||||||
|
|
||||||
Then you can just test it locally by spinning up a webserver in the `dist`
|
Then you can just test it locally by spinning up a webserver in the `dist`
|
||||||
@@ -66,7 +71,7 @@ map $args $format {
|
|||||||
~(^|&)format= other;
|
~(^|&)format= other;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine from the URI and the format parameter aboce if forwarding is needed.
|
# Determine from the URI and the format parameter above if forwarding is needed.
|
||||||
map $uri/$format $forward_to_ui {
|
map $uri/$format $forward_to_ui {
|
||||||
default 1; # The default is to forward.
|
default 1; # The default is to forward.
|
||||||
~^/ui 0; # If the URI point to the UI already, we are done.
|
~^/ui 0; # If the URI point to the UI already, we are done.
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ There are many different ways to update your Nominatim database.
|
|||||||
The following section describes how to keep it up-to-date with Pyosmium.
|
The following section describes how to keep it up-to-date with Pyosmium.
|
||||||
For a list of other methods see the output of `./utils/update.php --help`.
|
For a list of other methods see the output of `./utils/update.php --help`.
|
||||||
|
|
||||||
!!! warning
|
!!! important
|
||||||
If you have configured a flatnode file for the import, then you
|
If you have configured a flatnode file for the import, then you
|
||||||
need to keep this flatnode file around for updates as well.
|
need to keep this flatnode file around for updates.
|
||||||
|
|
||||||
#### Installing the newest version of Pyosmium
|
#### Installing the newest version of Pyosmium
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ following packages should get you started:
|
|||||||
|
|
||||||
## Prerequisites for testing and documentation
|
## Prerequisites for testing and documentation
|
||||||
|
|
||||||
The Nominatim tests suite consists of behavioural tests (using behave) and
|
The Nominatim test suite consists of behavioural tests (using behave) and
|
||||||
unit tests (using PHPUnit). It has the following additional requirements:
|
unit tests (using PHPUnit). It has the following additional requirements:
|
||||||
|
|
||||||
* [behave test framework](https://behave.readthedocs.io) >= 1.2.5
|
* [behave test framework](https://behave.readthedocs.io) >= 1.2.5
|
||||||
@@ -85,7 +85,7 @@ All tests are located in the `\test` directory.
|
|||||||
Some of the behavioural test expect a test database to be present. You need at
|
Some of the behavioural test expect a test database to be present. You need at
|
||||||
least 2GB RAM and 10GB disk space to create the database.
|
least 2GB RAM and 10GB disk space to create the database.
|
||||||
|
|
||||||
First create a separate directory for the test DB and Fetch the test planet
|
First create a separate directory for the test DB and fetch the test planet
|
||||||
data and the Tiger data for South Dakota:
|
data and the Tiger data for South Dakota:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# OSM Data Import
|
# OSM Data Import
|
||||||
|
|
||||||
OSM data is initially imported using osm2pgsql. Nominatim uses its own data
|
OSM data is initially imported using [osm2pgsql](https://osm2pgsql.org).
|
||||||
output style 'gazetteer', which differs from the output style created for
|
Nominatim uses its own data output style 'gazetteer', which differs from the
|
||||||
map rendering.
|
output style created for map rendering.
|
||||||
|
|
||||||
## Database Layout
|
## Database Layout
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ different purposes, which are explained in this chapter.
|
|||||||
## Search rank
|
## Search rank
|
||||||
|
|
||||||
The search rank describes the extent and importance of a place. It is used
|
The search rank describes the extent and importance of a place. It is used
|
||||||
when ranking search result. Simply put, if there are two results for a
|
when ranking search results. Simply put, if there are two results for a
|
||||||
search query which are otherwise equal, then the result with the _lower_
|
search query which are otherwise equal, then the result with the _lower_
|
||||||
search rank will be appear higher in the result list.
|
search rank will be appear higher in the result list.
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ This test directory is sturctured as follows:
|
|||||||
|
|
||||||
## PHP Unit Tests (`test/php`)
|
## PHP Unit Tests (`test/php`)
|
||||||
|
|
||||||
Unit tests can be found in the php/ directory and tests selected php functions.
|
Unit tests can be found in the php/ directory. They test selected php functions.
|
||||||
Very low coverage.
|
Very low coverage.
|
||||||
|
|
||||||
To execute the test suite run
|
To execute the test suite run
|
||||||
@@ -89,7 +89,7 @@ feature of behave which comes in handy when writing new tests.
|
|||||||
### API Tests (`test/bdd/api`)
|
### API Tests (`test/bdd/api`)
|
||||||
|
|
||||||
These tests are meant to test the different API endpoints and their parameters.
|
These tests are meant to test the different API endpoints and their parameters.
|
||||||
They require a to import several datasets into a test database.
|
They require to import several datasets into a test database.
|
||||||
See the [Development Setup chapter](Development-Environment.md#preparing-the-test-database)
|
See the [Development Setup chapter](Development-Environment.md#preparing-the-test-database)
|
||||||
for instructions on how to set up this database.
|
for instructions on how to set up this database.
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ the [phpcov](https://github.com/sebastianbergmann/phpcov) tool:
|
|||||||
|
|
||||||
These tests check the import and update of the Nominatim database. They do not
|
These tests check the import and update of the Nominatim database. They do not
|
||||||
test the correctness of osm2pgsql. Each test will write some data into the `place`
|
test the correctness of osm2pgsql. Each test will write some data into the `place`
|
||||||
table (and optionally `the planet_osm_*` tables if required) and then run
|
table (and optionally the `planet_osm_*` tables if required) and then run
|
||||||
Nominatim's processing functions on that.
|
Nominatim's processing functions on that.
|
||||||
|
|
||||||
These tests need to create their own test databases. By default they will be
|
These tests need to create their own test databases. By default they will be
|
||||||
@@ -139,4 +139,4 @@ needs superuser rights for postgres.
|
|||||||
### Import Tests (`test/bdd/osm2pgsql`)
|
### Import Tests (`test/bdd/osm2pgsql`)
|
||||||
|
|
||||||
These tests check that data is imported correctly into the place table. They
|
These tests check that data is imported correctly into the place table. They
|
||||||
use the same template database as the Indexing tests, so the same remarks apply.
|
use the same template database as the DB Creation tests, so the same remarks apply.
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ the address computation and the search frontend.
|
|||||||
The __data import__ stage reads the raw OSM data and extracts all information
|
The __data import__ stage reads the raw OSM data and extracts all information
|
||||||
that is useful for geocoding. This part is done by osm2pgsql, the same tool
|
that is useful for geocoding. This part is done by osm2pgsql, the same tool
|
||||||
that can also be used to import a rendering database. It uses the special
|
that can also be used to import a rendering database. It uses the special
|
||||||
gazetteer output plugin in `osm2pgsql/output-gazetter.[ch]pp`. The result of
|
gazetteer output plugin in `osm2pgsql/src/output-gazetter.[ch]pp`. The result of
|
||||||
the import can be found in the database table `place`.
|
the import can be found in the database table `place`.
|
||||||
|
|
||||||
The __address computation__ or __indexing__ stage takes the data from `place`
|
The __address computation__ or __indexing__ stage takes the data from `place`
|
||||||
and adds additional information needed for geocoding. It ranks the places by
|
and adds additional information needed for geocoding. It ranks the places by
|
||||||
importance, links objects that belong together and computes addresses and
|
importance, links objects that belong together and computes addresses and
|
||||||
the search index. Most of this work is done in PL/pgSQL via database triggers
|
the search index. Most of this work is done in PL/pgSQL via database triggers
|
||||||
and can be found in the file `sql/functions.sql`.
|
and can be found in the files in the `sql/functions/` directory.
|
||||||
|
|
||||||
The __search frontend__ implements the actual API. It takes search
|
The __search frontend__ implements the actual API. It takes search
|
||||||
and reverse geocoding queries from the user, looks up the data and
|
and reverse geocoding queries from the user, looks up the data and
|
||||||
|
|||||||
Reference in New Issue
Block a user