From: Sarah Hoffmann Date: Sun, 6 Dec 2020 16:28:33 +0000 (+0100) Subject: updates to admin and develop documentation X-Git-Tag: v3.6.0~3^2~3 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/603367dced978cfec5642764367a093dc37ccabf updates to admin and develop documentation Mostly minor updates in wording and resource consumption. --- diff --git a/docs/admin/Import.md b/docs/admin/Import.md index 334c1b75..853cde61 100644 --- a/docs/admin/Import.md +++ b/docs/admin/Import.md @@ -29,7 +29,7 @@ Add to your `settings/local.php`: @define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file'); 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 @@ -43,7 +43,7 @@ This data is available as a binary download: cd $NOMINATIM_SOURCE_DIR/data 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 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/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 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 -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. [Geofabrik](https://download.geofabrik.de) offers extracts for most countries. 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). 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 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 -needed for the import on a machine with 64GB RAM, 4 CPUS and SSDs. Note that -the given sizes are just an estimate meant for comparison of style requirements. -Your planet import is likely to be larger as the OSM data grows with 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 NVME disks. +Note that the given sizes are just an estimate meant for comparison of +style requirements. Your planet import is likely to be larger as the +OSM data grows with time. 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 address | 59h | 500 GB | 260 GB full | 80h | 575 GB | 300 GB extratags | 80h | 585 GB | 310 GB -You can also customize the styles further. For a description of the -style format see [the development section](../develop/Import.md). +You can also customize the styles further. +A [description of the style format](../develop/Import.md#configuring-the-import) +can be found in the development section. ## 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 [Geofabrik](https://download.geofabrik.de). -Download the data to import and load the data with the following command -from the build directory: +Download the data to import. Then issue the following command +from the **build directory** to start the import: ```sh ./utils/setup.php --osm-file --all 2>&1 | tee setup.log ``` -***Note for full planet imports:*** Even on a perfectly configured machine -the import of a full planet takes at least 2 days. Once you see messages +### Notes on full planet imports + +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 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 @@ -167,11 +171,12 @@ configuration as it may not be optimal for the import. ### Notes on memory usage -In the first step of the import Nominatim uses osm2pgsql to load the OSM data -into the PostgreSQL database. This step is very demanding in terms of RAM usage. -osm2pgsql and PostgreSQL are running in parallel at this point. PostgreSQL -blocks at least the part of RAM that has been configured with the -`shared_buffers` parameter during [PostgreSQL tuning](Installation#postgresql-tuning) +In the first step of the import Nominatim uses [osm2pgsql](https://osm2pgsql.org) +to load the OSM data into the PostgreSQL database. This step is very demanding +in terms of RAM usage. osm2pgsql and PostgreSQL are running in parallel at +this point. PostgreSQL blocks at least the part of RAM that has been configured +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 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 @@ -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. 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 -enough RAM for PostgreSQL and osm2pgsql as mentioned above. If the system starts -swapping or you are getting out-of-memory errors, reduce the cache size or -even consider using a flatnode file. +the size of the OSM pbf file you are importing. The size needs to be given in +MB. Make sure you leave enough RAM for PostgreSQL and osm2pgsql as mentioned +above. If the system starts swapping or you are getting out-of-memory errors, +reduce the cache size or even consider using a flatnode file. ### Verify the import @@ -197,7 +202,7 @@ Run this script to verify all required tables and indices got created successful ### 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. ```sh diff --git a/docs/admin/Setup-Nominatim-UI.md b/docs/admin/Setup-Nominatim-UI.md index 9a6e163b..6aee4a0b 100644 --- a/docs/admin/Setup-Nominatim-UI.md +++ b/docs/admin/Setup-Nominatim-UI.md @@ -17,7 +17,12 @@ Clone the source from github: 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. Then you can just test it locally by spinning up a webserver in the `dist` @@ -66,7 +71,7 @@ map $args $format { ~(^|&)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 { default 1; # The default is to forward. ~^/ui 0; # If the URI point to the UI already, we are done. diff --git a/docs/admin/Update.md b/docs/admin/Update.md index b4692321..4ddfc9de 100644 --- a/docs/admin/Update.md +++ b/docs/admin/Update.md @@ -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. 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 - 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 diff --git a/docs/develop/Development-Environment.md b/docs/develop/Development-Environment.md index b7b0a673..2f6f54ce 100644 --- a/docs/develop/Development-Environment.md +++ b/docs/develop/Development-Environment.md @@ -25,7 +25,7 @@ following packages should get you started: ## 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: * [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 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: ``` diff --git a/docs/develop/Import.md b/docs/develop/Import.md index 5a323d26..b3e268f3 100644 --- a/docs/develop/Import.md +++ b/docs/develop/Import.md @@ -1,8 +1,8 @@ # OSM Data Import -OSM data is initially imported using osm2pgsql. Nominatim uses its own data -output style 'gazetteer', which differs from the output style created for -map rendering. +OSM data is initially imported using [osm2pgsql](https://osm2pgsql.org). +Nominatim uses its own data output style 'gazetteer', which differs from the +output style created for map rendering. ## Database Layout diff --git a/docs/develop/Ranking.md b/docs/develop/Ranking.md index 06f25500..3caeb50e 100644 --- a/docs/develop/Ranking.md +++ b/docs/develop/Ranking.md @@ -7,7 +7,7 @@ different purposes, which are explained in this chapter. ## Search rank 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 rank will be appear higher in the result list. diff --git a/docs/develop/Testing.md b/docs/develop/Testing.md index 03f9574f..3c9d437f 100644 --- a/docs/develop/Testing.md +++ b/docs/develop/Testing.md @@ -27,7 +27,7 @@ This test directory is sturctured as follows: ## 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. 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`) 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) 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 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. 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`) 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. diff --git a/docs/develop/overview.md b/docs/develop/overview.md index c0a37a41..b5625a88 100644 --- a/docs/develop/overview.md +++ b/docs/develop/overview.md @@ -9,14 +9,14 @@ the address computation and the search frontend. 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 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 __address computation__ or __indexing__ stage takes the data from `place` and adds additional information needed for geocoding. It ranks the places by 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 -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 and reverse geocoding queries from the user, looks up the data and