1 This section provides a reference of all configuration parameters that can
2 be used with Nominatim.
4 # Configuring Nominatim
6 Nominatim uses [dotenv](https://github.com/theskumar/python-dotenv) to manage
7 its configuration settings. There are two means to set configuration
8 variables: through an `.env` configuration file or through an environment
11 The `.env` configuration file needs to be placed into the
12 [project directory](../admin/Import.md#creating-the-project-directory). It
13 must contain configuration parameters in `<parameter>=<value>` format.
14 Please refer to the dotenv documentation for details.
16 The configuration options may also be set in the form of shell environment
17 variables. This is particularly useful, when you want to temporarily change
18 a configuration option. For example, to force the replication serve to
19 download the next change, you can temporarily disable the update interval:
21 NOMINATIM_REPLICATION_UPDATE_INTERVAL=0 nominatim replication --once
23 If a configuration option is defined through .env file and environment
24 variable, then the latter takes precedence.
26 ## Configuration Parameter Reference
28 ### Import and Database Settings
30 #### NOMINATIM_DATABASE_DSN
33 | -------------- | --------------------------------------------------- |
34 | **Description:** | Database connection string |
35 | **Format:** | string: `pgsql:<param1>=<value1>;<param2>=<value2>;...` |
36 | **Default:** | pgsql:dbname=nominatim |
37 | **After Changes:** | run `nominatim refresh --website` |
39 Sets the connection parameters for the Nominatim database. At a minimum
40 the name of the database (`dbname`) is required. You can set any additional
41 parameter that is understood by libpq. See the [Postgres documentation](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS) for a full list.
44 It is usually recommended not to set the password directly in this
45 configuration parameter. Use a
46 [password file](https://www.postgresql.org/docs/current/libpq-pgpass.html)
50 #### NOMINATIM_DATABASE_WEBUSER
53 | -------------- | --------------------------------------------------- |
54 | **Description:** | Database query user |
55 | **Format:** | string |
56 | **Default:** | www-data |
57 | **After Changes:** | cannot be changed after import |
59 Defines the name of the database user that will run search queries. Usually
60 this is the user under which the webserver is executed. When running Nominatim
61 via php-fpm, you can also define a separate query user. The Postgres user
62 needs to be set up before starting the import.
64 Nominatim grants minimal rights to this user to all tables that are needed
65 for running geocoding queries.
68 #### NOMINATIM_DATABASE_MODULE_PATH
71 | -------------- | --------------------------------------------------- |
72 | **Description:** | Directory where to find the PostgreSQL server module |
73 | **Format:** | path |
74 | **Default:** | _empty_ (use `<project_directory>/module`) |
75 | **After Changes:** | run `nominatim refresh --functions` |
76 | **Comment:** | Legacy tokenizer only |
78 Defines the directory in which the PostgreSQL server module `nominatim.so`
79 is stored. The directory and module must be accessible by the PostgreSQL
82 For information on how to use this setting when working with external databases,
83 see [Advanced Installations](../admin/Advanced-Installations.md).
85 The option is only used by the Legacy tokenizer and ignored otherwise.
88 #### NOMINATIM_TOKENIZER
91 | -------------- | --------------------------------------------------- |
92 | **Description:** | Tokenizer used for normalizing and parsing queries and names |
93 | **Format:** | string |
94 | **Default:** | legacy |
95 | **After Changes:** | cannot be changed after import |
97 Sets the tokenizer type to use for the import. For more information on
98 available tokenizers and how they are configured, see
99 [Tokenizers](../customize/Tokenizers.md).
102 #### NOMINATIM_TOKENIZER_CONFIG
105 | -------------- | --------------------------------------------------- |
106 | **Description:** | Configuration file for the tokenizer |
107 | **Format:** | path |
108 | **Default:** | _empty_ (default file depends on tokenizer) |
109 | **After Changes:** | see documentation for each tokenizer |
111 Points to the file with additional configuration for the tokenizer.
112 See the [Tokenizer](../customize/Tokenizers.md) descriptions for details
115 If a relative path is given, then the file is searched first relative to the
116 project directory and then in the global settings directory.
118 #### NOMINATIM_MAX_WORD_FREQUENCY
121 | -------------- | --------------------------------------------------- |
122 | **Description:** | Number of occurrences before a word is considered frequent |
123 | **Format:** | int |
124 | **Default:** | 50000 |
125 | **After Changes:** | cannot be changed after import |
126 | **Comment:** | Legacy tokenizer only |
128 The word frequency count is used by the Legacy tokenizer to automatically
129 identify _stop words_. Any partial term that occurs more often then what
130 is defined in this setting, is effectively ignored during search.
133 #### NOMINATIM_LIMIT_REINDEXING
136 | -------------- | --------------------------------------------------- |
137 | **Description:** | Avoid invalidating large areas |
138 | **Format:** | bool |
139 | **Default:** | yes |
141 Nominatim computes the address of each place at indexing time. This has the
142 advantage to make search faster but also means that more objects needs to
143 be invalidated when the data changes. For example, changing the name of
144 the state of Florida would require recomputing every single address point
145 in the state to make the new name searchable in conjunction with addresses.
147 Setting this option to 'yes' means that Nominatim skips reindexing of contained
148 objects when the area becomes too large.
151 #### NOMINATIM_UPDATE_FORWARD_DEPENDENCIES
154 | -------------- | --------------------------------------------------- |
155 | **Description:** | Forward geometry changes to dependet objects |
156 | **Format:** | bool |
157 | **Default:** | no |
158 | **Comment:** | EXPERT ONLY. Must not be enabled after import. |
160 The geometry of OSM ways and relations may change when a node that is part
161 of the object is moved around. These changes are not propagated per default.
162 The geometry of ways/relations is only updated the next time that the object
163 itself is touched. When enabling this option, then dependent objects will
164 be marked for update when one of its member objects changes.
166 Enabling this option may slow down updates significantly.
169 If you want to enable this option, it must be set already on import.
170 Do not enable this option on an existing database that was imported with
171 NOMINATIM_UPDATE_FORWARD_DEPENDENCIES=no.
172 Updates will become unusably slow.
174 #### NOMINATIM_LANGUAGES
177 | -------------- | --------------------------------------------------- |
178 | **Description:** | Restrict search languages |
179 | **Format:** | string: comma-separated list of language codes |
180 | **Default:** | _empty_ |
182 Normally Nominatim will include all language variants of name:XX
183 in the search index. Set this to a comma separated list of language
184 codes, to restrict import to a subset of languages.
186 Currently only affects the initial import of country names and special phrases.
189 #### NOMINATIM_TERM_NORMALIZATION
192 | -------------- | --------------------------------------------------- |
193 | **Description:** | Rules for normalizing terms for comparisons |
194 | **Format:** | string: semicolon-separated list of ICU rules |
195 | **Default:** | :: NFD (); [[:Nonspacing Mark:] [:Cf:]] >; :: lower (); [[:Punctuation:][:Space:]]+ > ' '; :: NFC (); |
196 | **Comment:** | Legacy tokenizer only |
198 [Special phrases](Special-Phrases.md) have stricter matching requirements than
199 normal search terms. They must appear exactly in the query after this term
200 normalization has been applied.
202 Only has an effect on the Legacy tokenizer. For the ICU tokenizer the rules
204 [normalization section](Tokenizers.md#normalization-and-transliteration)
208 #### NOMINATIM_USE_US_TIGER_DATA
211 | -------------- | --------------------------------------------------- |
212 | **Description:** | Enable searching for Tiger house number data |
213 | **Format:** | boolean |
214 | **Default:** | no |
215 | **After Changes:** | run `nominatim refresh --functions` |
217 When this setting is enabled, search and reverse queries also take data
218 from [Tiger house number data](Tiger.md) into account.
221 #### NOMINATIM_USE_AUX_LOCATION_DATA
224 | -------------- | --------------------------------------------------- |
225 | **Description:** | Enable searching in external house number tables |
226 | **Format:** | boolean |
227 | **Default:** | no |
228 | **After Changes:** | run `nominatim refresh --functions` |
229 | **Comment:** | Do not use. |
231 When this setting is enabled, search queries also take data from external
232 house number tables into account.
234 *Warning:* This feature is currently unmaintained and should not be used.
237 #### NOMINATIM_HTTP_PROXY
240 | -------------- | --------------------------------------------------- |
241 | **Description:** | Use HTTP proxy when downloading data |
242 | **Format:** | boolean |
243 | **Default:** | no |
245 When this setting is enabled and at least
246 [NOMINATIM_HTTP_PROXY_HOST](#nominatim_http_proxy_host) and
247 [NOMINATIM_HTTP_PROXY_PORT](#nominatim_http_proxy_port) are set, the
248 configured proxy will be used, when downloading external data like
252 #### NOMINATIM_HTTP_PROXY_HOST
255 | -------------- | --------------------------------------------------- |
256 | **Description:** | Host name of the proxy to use |
257 | **Format:** | string |
258 | **Default:** | _empty_ |
260 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, this setting
261 configures the proxy host name.
264 #### NOMINATIM_HTTP_PROXY_PORT
267 | -------------- | --------------------------------------------------- |
268 | **Description:** | Port number of the proxy to use |
269 | **Format:** | integer |
270 | **Default:** | 3128 |
272 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, this setting
273 configures the port number to use with the proxy.
276 #### NOMINATIM_HTTP_PROXY_LOGIN
279 | -------------- | --------------------------------------------------- |
280 | **Description:** | Username for proxies that require login |
281 | **Format:** | string |
282 | **Default:** | _empty_ |
284 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, use this
285 setting to define the username for proxies that require a login.
288 #### NOMINATIM_HTTP_PROXY_PASSWORD
291 | -------------- | --------------------------------------------------- |
292 | **Description:** | Password for proxies that require login |
293 | **Format:** | string |
294 | **Default:** | _empty_ |
296 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, use this
297 setting to define the password for proxies that require a login.
300 #### NOMINATIM_OSM2PGSQL_BINARY
303 | -------------- | --------------------------------------------------- |
304 | **Description:** | Location of the osm2pgsql binary |
305 | **Format:** | path |
306 | **Default:** | _empty_ (use binary shipped with Nominatim) |
307 | **Comment:** | EXPERT ONLY |
309 Nominatim uses [osm2pgsql](https://osm2pgsql.org) to load the OSM data
310 initially into the database. Nominatim comes bundled with a version of
311 osm2pgsql that is guaranteed to be compatible. Use this setting to use
312 a different binary instead. You should do this only when you know exactly
313 what you are doing. If the osm2pgsql version is not compatible, then the
317 #### NOMINATIM_WIKIPEDIA_DATA_PATH
320 | -------------- | --------------------------------------------------- |
321 | **Description:** | Directory with the wikipedia importance data |
322 | **Format:** | path |
323 | **Default:** | _empty_ (project directory) |
325 Set a custom location for the
326 [wikipedia ranking file](../admin/Import.md#wikipediawikidata-rankings). When
327 unset, Nominatim expects the data to be saved in the project directory.
329 #### NOMINATIM_ADDRESS_LEVEL_CONFIG
332 | -------------- | --------------------------------------------------- |
333 | **Description:** | Configuration file for rank assignments |
334 | **Format:** | path |
335 | **Default:** | address-levels.json |
337 The _address level configuration_ defines the rank assignments for places. See
338 [Place Ranking](Ranking.md) for a detailed explanation what rank assignments
339 are and what the configuration file must look like.
341 When a relative path is given, then the file is searched first relative to the
342 project directory and then in the global settings directory.
345 #### NOMINATIM_IMPORT_STYLE
348 | -------------- | --------------------------------------------------- |
349 | **Description:** | Configuration to use for the initial OSM data import |
350 | **Format:** | string or path |
351 | **Default:** | extratags |
353 The _style configuration_ describes which OSM objects and tags are taken
354 into consideration for the search database. Nominatim comes with a set
355 of pre-configured styles, that may be configured here.
357 You can also write your own custom style and point the setting to the file
358 with the style. When a relative path is given, then the style file is searched
359 first relative to the project directory and then in the global settings
362 See [Import Styles](Import-Styles.md)
363 for more information on the available internal styles and the format of the
366 #### NOMINATIM_FLATNODE_FILE
369 | -------------- | --------------------------------------------------- |
370 | **Description:** | Location of osm2pgsql flatnode file |
371 | **Format:** | path |
372 | **Default:** | _empty_ (do not use a flatnote file) |
373 | **After Changes:** | Only change when moving the file physically. |
375 The `osm2pgsql flatnode file` is file that efficiently stores geographic
376 location for OSM nodes. For larger imports it can significantly speed up
377 the import. When this option is unset, then osm2pgsql uses a PsotgreSQL table
378 to store the locations.
380 When a relative path is given, then the flatnode file is created/searched
381 relative to the project directory.
385 The flatnode file is not only used during the initial import but also
386 when adding new data with `nominatim add-data` or `nominatim replication`.
387 Make sure you keep the flatnode file around and this setting unmodified,
388 if you plan to add more data or run regular updates.
391 #### NOMINATIM_TABLESPACE_*
394 | -------------- | --------------------------------------------------- |
395 | **Description:** | Group of settings for distributing the database over tablespaces |
396 | **Format:** | string |
397 | **Default:** | _empty_ (do not use a table space) |
398 | **After Changes:** | no effect after initial import |
400 Nominatim allows to distribute the search database over up to 10 different
401 [PostgreSQL tablespaces](https://www.postgresql.org/docs/current/manage-ag-tablespaces.html).
402 If you use this option, make sure that the tablespaces exist before starting
405 The available tablespace groups are:
407 NOMINATIM_TABLESPACE_SEARCH_DATA
408 : Data used by the geocoding frontend.
410 NOMINATIM_TABLESPACE_SEARCH_INDEX
411 : Indexes used by the geocoding frontend.
413 NOMINATIM_TABLESPACE_OSM_DATA
414 : Raw OSM data cache used for import and updates.
416 NOMINATIM_TABLESPACE_OSM_DATA
417 : Indexes on the raw OSM data cache.
419 NOMINATIM_TABLESPACE_PLACE_DATA
420 : Data table with the pre-filtered but still unprocessed OSM data.
421 Used only during imports and updates.
423 NOMINATIM_TABLESPACE_PLACE_INDEX
424 : Indexes on raw data table. Used only during imports and updates.
426 NOMINATIM_TABLESPACE_ADDRESS_DATA
427 : Data tables used for computing search terms and addresses of places
428 during import and updates.
430 NOMINATIM_TABLESPACE_ADDRESS_INDEX
431 : Indexes on the data tables for search term and address computation.
432 Used only for import and updates.
434 NOMINATIM_TABLESPACE_AUX_DATA
435 : Auxiliary data tables for non-OSM data, e.g. for Tiger house number data.
437 NOMINATIM_TABLESPACE_AUX_INDEX
438 : Indexes on auxiliary data tables.
441 ### Replication Update Settings
443 #### NOMINATIM_REPLICATION_URL
446 | -------------- | --------------------------------------------------- |
447 | **Description:** | Base URL of the replication service |
448 | **Format:** | url |
449 | **Default:** | https://planet.openstreetmap.org/replication/minute |
450 | **After Changes:** | run `nominatim replication --init` |
452 Replication services deliver updates to OSM data. Use this setting to choose
453 which replication service to use. See [Updates](../admin/Update.md) for more
454 information on how to set up regular updates.
456 #### NOMINATIM_REPLICATION_MAX_DIFF
459 | -------------- | --------------------------------------------------- |
460 | **Description:** | Maximum amount of data to download per update cycle (in MB) |
461 | **Format:** | integer |
462 | **Default:** | 50 |
463 | **After Changes:** | restart the replication process |
465 At each update cycle Nominatim downloads diffs until either no more diffs
466 are available on the server (i.e. the database is up-to-date) or the limit
467 given in this setting is exceeded. Nominatim guarantees to downloads at least
468 one diff, if one is available, no matter how small the setting.
470 The default for this setting is fairly conservative because Nominatim keeps
471 all data downloaded in one cycle in RAM. Using large values in a production
472 server may interfere badly with the search frontend because it evicts data
473 from RAM that is needed for speedy answers to incoming requests. It is usually
474 a better idea to keep this setting lower and run multiple update cycles
475 to catch up with updates.
477 When catching up in non-production mode, for example after the initial import,
478 the setting can easily be changed temporarily on the command line:
480 NOMINATIM_REPLICATION_MAX_DIFF=3000 nominatim replication
483 #### NOMINATIM_REPLICATION_UPDATE_INTERVAL
486 | -------------- | --------------------------------------------------- |
487 | **Description:** | Publication interval of the replication service (in seconds) |
488 | **Format:** | integer |
489 | **Default:** | 75 |
490 | **After Changes:** | restart the replication process |
492 This setting determines when Nominatim will attempt to download again a new
493 update. The time is computed from the publication date of the last diff
494 downloaded. Setting this to a slightly higher value than the actual
495 publication interval avoids unnecessary rechecks.
498 #### NOMINATIM_REPLICATION_RECHECK_INTERVAL
501 | -------------- | --------------------------------------------------- |
502 | **Description:** | Wait time to recheck for a pending update (in seconds) |
503 | **Format:** | integer |
504 | **Default:** | 60 |
505 | **After Changes:** | restart the replication process |
507 When replication updates are run in continuous mode (using `nominatim replication`),
508 this setting determines how long Nominatim waits until it looks for updates
509 again when updates were not available on the server.
511 Note that this is different from
512 [NOMINATIM_REPLICATION_UPDATE_INTERVAL](#nominatim_replication_update_interval).
513 Nominatim will never attempt to query for new updates for UPDATE_INTERVAL
514 seconds after the current database date. Only after the update interval has
515 passed it asks for new data. If then no new data is found, it waits for
516 RECHECK_INTERVAL seconds before it attempts again.
520 #### NOMINATIM_CORS_NOACCESSCONTROL
523 | -------------- | --------------------------------------------------- |
524 | **Description:** | Send permissive CORS access headers |
525 | **Format:** | boolean |
526 | **Default:** | yes |
527 | **After Changes:** | run `nominatim refresh --website` |
529 When this setting is enabled, API HTTP responses include the HTTP
530 [CORS](https://en.wikipedia.org/wiki/CORS) headers
531 `access-control-allow-origin: *` and `access-control-allow-methods: OPTIONS,GET`.
533 #### NOMINATIM_MAPICON_URL
536 | -------------- | --------------------------------------------------- |
537 | **Description:** | URL prefix for static icon images |
538 | **Format:** | url |
539 | **Default:** | _empty_ |
540 | **After Changes:** | run `nominatim refresh --website` |
542 When a mapicon URL is configured, then Nominatim includes an additional `icon`
543 field in the responses, pointing to an appropriate icon for the place type.
545 Map icons used to be included in Nominatim itself but now have moved to the
546 [nominatim-ui](https://github.com/osm-search/nominatim-ui/) project. If you
547 want the URL to be included in API responses, make the `/mapicon`
548 directory of the project available under a public URL and point this setting
552 #### NOMINATIM_DEFAULT_LANGUAGE
555 | -------------- | --------------------------------------------------- |
556 | **Description:** | Language of responses when no language is requested |
557 | **Format:** | language code |
558 | **Default:** | _empty_ (use the local language of the feature) |
559 | **After Changes:** | run `nominatim refresh --website` |
561 Nominatim localizes the place names in responses when the corresponding
562 translation is available. Users can request a custom language setting through
563 the HTTP accept-languages header or through the explicit parameter
564 [accept-languages](../api/Search.md#language-of-results). If neither is
565 given, it falls back to this setting. If the setting is also empty, then
566 the local languages (in OSM: the name tag without any language suffix) is
570 #### NOMINATIM_SEARCH_BATCH_MODE
573 | -------------- | --------------------------------------------------- |
574 | **Description:** | Enable a special batch query mode |
575 | **Format:** | boolean |
576 | **Default:** | no |
577 | **After Changes:** | run `nominatim refresh --website` |
579 This feature is currently undocumented and potentially broken.
582 #### NOMINATIM_SEARCH_NAME_ONLY_THRESHOLD
585 | -------------- | --------------------------------------------------- |
586 | **Description:** | Threshold for switching the search index lookup strategy |
587 | **Format:** | integer |
588 | **Default:** | 500 |
589 | **After Changes:** | run `nominatim refresh --website` |
591 This setting defines the threshold over which a name is no longer considered
592 as rare. When searching for places with rare names, only the name is used
593 for place lookups. Otherwise the name and any address information is used.
595 This setting only has an effect after `nominatim refresh --word-counts` has
596 been called to compute the word frequencies.
599 #### NOMINATIM_LOOKUP_MAX_COUNT
602 | -------------- | --------------------------------------------------- |
603 | **Description:** | Maximum number of OSM ids accepted by /lookup |
604 | **Format:** | integer |
605 | **Default:** | 50 |
606 | **After Changes:** | run `nominatim refresh --website` |
608 The /lookup point accepts list of ids to look up address details for. This
609 setting restricts the number of places a user may look up with a single
613 #### NOMINATIM_POLYGON_OUTPUT_MAX_TYPES
616 | -------------- | --------------------------------------------------- |
617 | **Description:** | Number of different geometry formats that may be returned |
618 | **Format:** | integer |
620 | **After Changes:** | run `nominatim refresh --website` |
622 Nominatim supports returning full geometries of places. The geometries may
623 be requested in different formats with one of the
624 [`polygon_*` parameters](../api/Search.md#polygon-output). Use this
625 setting to restrict the number of geometry types that may be requested
628 Setting this parameter to 0 disables polygon output completely.
631 #### NOMINATIM_SEARCH_WITHIN_COUNTRIES
634 | -------------- | --------------------------------------------------- |
635 | **Description:** | Disable search for elements that are not in the country grid |
636 | **Format:** | boolean |
637 | **Default:** | no |
638 | **After Changes:** | run `nominatim refresh --website` |
640 Enable to search elements just within countries.
642 When enabled, if, despite not finding a point within the static grid of countries, it
643 finds a geometry of a region, do not return the geometry.
644 Return "Unable to geocode" instead.
649 #### NOMINATIM_LOG_DB
652 | -------------- | --------------------------------------------------- |
653 | **Description:** | Log requests into the database |
654 | **Format:** | boolean |
655 | **Default:** | no |
656 | **After Changes:** | run `nominatim refresh --website` |
658 Enable logging requests into a database table with this setting. The logs
659 can be found in the table `new_query_log`.
661 When using this logging method, it is advisable to set up a job that
662 regularly clears out old logging information. Nominatim will not do that
665 Can be used as the same time as NOMINATIM_LOG_FILE.
667 #### NOMINATIM_LOG_FILE
670 | -------------- | --------------------------------------------------- |
671 | **Description:** | Log requests into a file |
672 | **Format:** | path |
673 | **Default:** | _empty_ (logging disabled) |
674 | **After Changes:** | run `nominatim refresh --website` |
676 Enable logging of requests into a file with this setting by setting the log
677 file where to log to. A relative file name is assumed to be relative to
678 the project directory.
681 The entries in the log file have the following format:
683 <request time> <execution time in s> <number of results> <type> "<query string>"
685 Request time is the time when the request was started. The execution time is
686 given in seconds and corresponds to the time the query took executing in PHP.
687 type contains the name of the endpoint used.
689 Can be used as the same time as NOMINATIM_LOG_DB.