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. The Postgres user
61 needs to be set up before starting the import.
63 Nominatim grants minimal rights to this user to all tables that are needed
64 for running geocoding queries.
67 #### NOMINATIM_DATABASE_MODULE_PATH
70 | -------------- | --------------------------------------------------- |
71 | **Description:** | Directory where to find the PostgreSQL server module |
72 | **Format:** | path |
73 | **Default:** | _empty_ (use `<project_directory>/module`) |
74 | **After Changes:** | run `nominatim refresh --functions` |
75 | **Comment:** | Legacy tokenizer only |
77 Defines the directory in which the PostgreSQL server module `nominatim.so`
78 is stored. The directory and module must be accessible by the PostgreSQL
81 For information on how to use this setting when working with external databases,
82 see [Advanced Installations](../admin/Advanced-Installations.md).
84 The option is only used by the Legacy tokenizer and ignored otherwise.
87 #### NOMINATIM_TOKENIZER
90 | -------------- | --------------------------------------------------- |
91 | **Description:** | Tokenizer used for normalizing and parsing queries and names |
92 | **Format:** | string |
93 | **Default:** | icu |
94 | **After Changes:** | cannot be changed after import |
96 Sets the tokenizer type to use for the import. For more information on
97 available tokenizers and how they are configured, see
98 [Tokenizers](../customize/Tokenizers.md).
101 #### NOMINATIM_TOKENIZER_CONFIG
104 | -------------- | --------------------------------------------------- |
105 | **Description:** | Configuration file for the tokenizer |
106 | **Format:** | path |
107 | **Default:** | _empty_ (default file depends on tokenizer) |
108 | **After Changes:** | see documentation for each tokenizer |
110 Points to the file with additional configuration for the tokenizer.
111 See the [Tokenizer](../customize/Tokenizers.md) descriptions for details
114 If a relative path is given, then the file is searched first relative to the
115 project directory and then in the global settings directory.
117 #### NOMINATIM_MAX_WORD_FREQUENCY
120 | -------------- | --------------------------------------------------- |
121 | **Description:** | Number of occurrences before a word is considered frequent |
122 | **Format:** | int |
123 | **Default:** | 50000 |
124 | **After Changes:** | cannot be changed after import |
125 | **Comment:** | Legacy tokenizer only |
127 The word frequency count is used by the Legacy tokenizer to automatically
128 identify _stop words_. Any partial term that occurs more often then what
129 is defined in this setting, is effectively ignored during search.
132 #### NOMINATIM_LIMIT_REINDEXING
135 | -------------- | --------------------------------------------------- |
136 | **Description:** | Avoid invalidating large areas |
137 | **Format:** | bool |
138 | **Default:** | yes |
140 Nominatim computes the address of each place at indexing time. This has the
141 advantage to make search faster but also means that more objects needs to
142 be invalidated when the data changes. For example, changing the name of
143 the state of Florida would require recomputing every single address point
144 in the state to make the new name searchable in conjunction with addresses.
146 Setting this option to 'yes' means that Nominatim skips reindexing of contained
147 objects when the area becomes too large.
150 #### NOMINATIM_LANGUAGES
153 | -------------- | --------------------------------------------------- |
154 | **Description:** | Restrict search languages |
155 | **Format:** | string: comma-separated list of language codes |
156 | **Default:** | _empty_ |
158 Normally Nominatim will include all language variants of name:XX
159 in the search index. Set this to a comma separated list of language
160 codes, to restrict import to a subset of languages.
162 Currently only affects the initial import of country names and special phrases.
165 #### NOMINATIM_TERM_NORMALIZATION
168 | -------------- | --------------------------------------------------- |
169 | **Description:** | Rules for normalizing terms for comparisons |
170 | **Format:** | string: semicolon-separated list of ICU rules |
171 | **Default:** | :: NFD (); [[:Nonspacing Mark:] [:Cf:]] >; :: lower (); [[:Punctuation:][:Space:]]+ > ' '; :: NFC (); |
172 | **Comment:** | Legacy tokenizer only |
174 [Special phrases](Special-Phrases.md) have stricter matching requirements than
175 normal search terms. They must appear exactly in the query after this term
176 normalization has been applied.
178 Only has an effect on the Legacy tokenizer. For the ICU tokenizer the rules
180 [normalization section](Tokenizers.md#normalization-and-transliteration)
184 #### NOMINATIM_USE_US_TIGER_DATA
187 | -------------- | --------------------------------------------------- |
188 | **Description:** | Enable searching for Tiger house number data |
189 | **Format:** | boolean |
190 | **Default:** | no |
191 | **After Changes:** | run `nominatim refresh --functions` |
193 When this setting is enabled, search and reverse queries also take data
194 from [Tiger house number data](Tiger.md) into account.
197 #### NOMINATIM_USE_AUX_LOCATION_DATA
200 | -------------- | --------------------------------------------------- |
201 | **Description:** | Enable searching in external house number tables |
202 | **Format:** | boolean |
203 | **Default:** | no |
204 | **After Changes:** | run `nominatim refresh --functions` |
205 | **Comment:** | Do not use. |
207 When this setting is enabled, search queries also take data from external
208 house number tables into account.
210 *Warning:* This feature is currently unmaintained and should not be used.
213 #### NOMINATIM_HTTP_PROXY
216 | -------------- | --------------------------------------------------- |
217 | **Description:** | Use HTTP proxy when downloading data |
218 | **Format:** | boolean |
219 | **Default:** | no |
221 When this setting is enabled and at least
222 [NOMINATIM_HTTP_PROXY_HOST](#nominatim_http_proxy_host) and
223 [NOMINATIM_HTTP_PROXY_PORT](#nominatim_http_proxy_port) are set, the
224 configured proxy will be used, when downloading external data like
228 #### NOMINATIM_HTTP_PROXY_HOST
231 | -------------- | --------------------------------------------------- |
232 | **Description:** | Host name of the proxy to use |
233 | **Format:** | string |
234 | **Default:** | _empty_ |
236 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, this setting
237 configures the proxy host name.
240 #### NOMINATIM_HTTP_PROXY_PORT
243 | -------------- | --------------------------------------------------- |
244 | **Description:** | Port number of the proxy to use |
245 | **Format:** | integer |
246 | **Default:** | 3128 |
248 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, this setting
249 configures the port number to use with the proxy.
252 #### NOMINATIM_HTTP_PROXY_LOGIN
255 | -------------- | --------------------------------------------------- |
256 | **Description:** | Username for proxies that require login |
257 | **Format:** | string |
258 | **Default:** | _empty_ |
260 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, use this
261 setting to define the username for proxies that require a login.
264 #### NOMINATIM_HTTP_PROXY_PASSWORD
267 | -------------- | --------------------------------------------------- |
268 | **Description:** | Password for proxies that require login |
269 | **Format:** | string |
270 | **Default:** | _empty_ |
272 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, use this
273 setting to define the password for proxies that require a login.
276 #### NOMINATIM_OSM2PGSQL_BINARY
279 | -------------- | --------------------------------------------------- |
280 | **Description:** | Location of the osm2pgsql binary |
281 | **Format:** | path |
282 | **Default:** | _empty_ (use binary shipped with Nominatim) |
283 | **Comment:** | EXPERT ONLY |
285 Nominatim uses [osm2pgsql](https://osm2pgsql.org) to load the OSM data
286 initially into the database. Nominatim comes bundled with a version of
287 osm2pgsql that is guaranteed to be compatible. Use this setting to use
288 a different binary instead. You should do this only when you know exactly
289 what you are doing. If the osm2pgsql version is not compatible, then the
293 #### NOMINATIM_WIKIPEDIA_DATA_PATH
296 | -------------- | --------------------------------------------------- |
297 | **Description:** | Directory with the wikipedia importance data |
298 | **Format:** | path |
299 | **Default:** | _empty_ (project directory) |
301 Set a custom location for the
302 [wikipedia ranking file](../admin/Import.md#wikipediawikidata-rankings). When
303 unset, Nominatim expects the data to be saved in the project directory.
305 #### NOMINATIM_ADDRESS_LEVEL_CONFIG
308 | -------------- | --------------------------------------------------- |
309 | **Description:** | Configuration file for rank assignments |
310 | **Format:** | path |
311 | **Default:** | address-levels.json |
313 The _address level configuration_ defines the rank assignments for places. See
314 [Place Ranking](Ranking.md) for a detailed explanation what rank assignments
315 are and what the configuration file must look like.
317 When a relative path is given, then the file is searched first relative to the
318 project directory and then in the global settings directory.
321 #### NOMINATIM_IMPORT_STYLE
324 | -------------- | --------------------------------------------------- |
325 | **Description:** | Configuration to use for the initial OSM data import |
326 | **Format:** | string or path |
327 | **Default:** | extratags |
329 The _style configuration_ describes which OSM objects and tags are taken
330 into consideration for the search database. Nominatim comes with a set
331 of pre-configured styles, that may be configured here.
333 You can also write your own custom style and point the setting to the file
334 with the style. When a relative path is given, then the style file is searched
335 first relative to the project directory and then in the global settings
338 See [Import Styles](Import-Styles.md)
339 for more information on the available internal styles and the format of the
342 #### NOMINATIM_FLATNODE_FILE
345 | -------------- | --------------------------------------------------- |
346 | **Description:** | Location of osm2pgsql flatnode file |
347 | **Format:** | path |
348 | **Default:** | _empty_ (do not use a flatnote file) |
349 | **After Changes:** | Only change when moving the file physically. |
351 The `osm2pgsql flatnode file` is file that efficiently stores geographic
352 location for OSM nodes. For larger imports it can significantly speed up
353 the import. When this option is unset, then osm2pgsql uses a PsotgreSQL table
354 to store the locations.
356 When a relative path is given, then the flatnode file is created/searched
357 relative to the project directory.
361 The flatnode file is not only used during the initial import but also
362 when adding new data with `nominatim add-data` or `nominatim replication`.
363 Make sure you keep the flatnode file around and this setting unmodified,
364 if you plan to add more data or run regular updates.
367 #### NOMINATIM_TABLESPACE_*
370 | -------------- | --------------------------------------------------- |
371 | **Description:** | Group of settings for distributing the database over tablespaces |
372 | **Format:** | string |
373 | **Default:** | _empty_ (do not use a table space) |
374 | **After Changes:** | no effect after initial import |
376 Nominatim allows to distribute the search database over up to 10 different
377 [PostgreSQL tablespaces](https://www.postgresql.org/docs/current/manage-ag-tablespaces.html).
378 If you use this option, make sure that the tablespaces exist before starting
381 The available tablespace groups are:
383 NOMINATIM_TABLESPACE_SEARCH_DATA
384 : Data used by the geocoding frontend.
386 NOMINATIM_TABLESPACE_SEARCH_INDEX
387 : Indexes used by the geocoding frontend.
389 NOMINATIM_TABLESPACE_OSM_DATA
390 : Raw OSM data cache used for import and updates.
392 NOMINATIM_TABLESPACE_OSM_DATA
393 : Indexes on the raw OSM data cache.
395 NOMINATIM_TABLESPACE_PLACE_DATA
396 : Data table with the pre-filtered but still unprocessed OSM data.
397 Used only during imports and updates.
399 NOMINATIM_TABLESPACE_PLACE_INDEX
400 : Indexes on raw data table. Used only during imports and updates.
402 NOMINATIM_TABLESPACE_ADDRESS_DATA
403 : Data tables used for computing search terms and addresses of places
404 during import and updates.
406 NOMINATIM_TABLESPACE_ADDRESS_INDEX
407 : Indexes on the data tables for search term and address computation.
408 Used only for import and updates.
410 NOMINATIM_TABLESPACE_AUX_DATA
411 : Auxiliary data tables for non-OSM data, e.g. for Tiger house number data.
413 NOMINATIM_TABLESPACE_AUX_INDEX
414 : Indexes on auxiliary data tables.
417 ### Replication Update Settings
419 #### NOMINATIM_REPLICATION_URL
422 | -------------- | --------------------------------------------------- |
423 | **Description:** | Base URL of the replication service |
424 | **Format:** | url |
425 | **Default:** | https://planet.openstreetmap.org/replication/minute |
426 | **After Changes:** | run `nominatim replication --init` |
428 Replication services deliver updates to OSM data. Use this setting to choose
429 which replication service to use. See [Updates](../admin/Update.md) for more
430 information on how to set up regular updates.
432 #### NOMINATIM_REPLICATION_MAX_DIFF
435 | -------------- | --------------------------------------------------- |
436 | **Description:** | Maximum amount of data to download per update cycle (in MB) |
437 | **Format:** | integer |
438 | **Default:** | 50 |
439 | **After Changes:** | restart the replication process |
441 At each update cycle Nominatim downloads diffs until either no more diffs
442 are available on the server (i.e. the database is up-to-date) or the limit
443 given in this setting is exceeded. Nominatim guarantees to downloads at least
444 one diff, if one is available, no matter how small the setting.
446 The default for this setting is fairly conservative because Nominatim keeps
447 all data downloaded in one cycle in RAM. Using large values in a production
448 server may interfere badly with the search frontend because it evicts data
449 from RAM that is needed for speedy answers to incoming requests. It is usually
450 a better idea to keep this setting lower and run multiple update cycles
451 to catch up with updates.
453 When catching up in non-production mode, for example after the initial import,
454 the setting can easily be changed temporarily on the command line:
456 NOMINATIM_REPLICATION_MAX_DIFF=3000 nominatim replication
459 #### NOMINATIM_REPLICATION_UPDATE_INTERVAL
462 | -------------- | --------------------------------------------------- |
463 | **Description:** | Publication interval of the replication service (in seconds) |
464 | **Format:** | integer |
465 | **Default:** | 75 |
466 | **After Changes:** | restart the replication process |
468 This setting determines when Nominatim will attempt to download again a new
469 update. The time is computed from the publication date of the last diff
470 downloaded. Setting this to a slightly higher value than the actual
471 publication interval avoids unnecessary rechecks.
474 #### NOMINATIM_REPLICATION_RECHECK_INTERVAL
477 | -------------- | --------------------------------------------------- |
478 | **Description:** | Wait time to recheck for a pending update (in seconds) |
479 | **Format:** | integer |
480 | **Default:** | 60 |
481 | **After Changes:** | restart the replication process |
483 When replication updates are run in continuous mode (using `nominatim replication`),
484 this setting determines how long Nominatim waits until it looks for updates
485 again when updates were not available on the server.
487 Note that this is different from
488 [NOMINATIM_REPLICATION_UPDATE_INTERVAL](#nominatim_replication_update_interval).
489 Nominatim will never attempt to query for new updates for UPDATE_INTERVAL
490 seconds after the current database date. Only after the update interval has
491 passed it asks for new data. If then no new data is found, it waits for
492 RECHECK_INTERVAL seconds before it attempts again.
496 #### NOMINATIM_CORS_NOACCESSCONTROL
499 | -------------- | --------------------------------------------------- |
500 | **Description:** | Send permissive CORS access headers |
501 | **Format:** | boolean |
502 | **Default:** | yes |
503 | **After Changes:** | run `nominatim refresh --website` |
505 When this setting is enabled, API HTTP responses include the HTTP
506 [CORS](https://en.wikipedia.org/wiki/CORS) headers
507 `access-control-allow-origin: *` and `access-control-allow-methods: OPTIONS,GET`.
509 #### NOMINATIM_MAPICON_URL
512 | -------------- | --------------------------------------------------- |
513 | **Description:** | URL prefix for static icon images |
514 | **Format:** | url |
515 | **Default:** | _empty_ |
516 | **After Changes:** | run `nominatim refresh --website` |
518 When a mapicon URL is configured, then Nominatim includes an additional `icon`
519 field in the responses, pointing to an appropriate icon for the place type.
521 Map icons used to be included in Nominatim itself but now have moved to the
522 [nominatim-ui](https://github.com/osm-search/nominatim-ui/) project. If you
523 want the URL to be included in API responses, make the `/mapicon`
524 directory of the project available under a public URL and point this setting
528 #### NOMINATIM_DEFAULT_LANGUAGE
531 | -------------- | --------------------------------------------------- |
532 | **Description:** | Language of responses when no language is requested |
533 | **Format:** | language code |
534 | **Default:** | _empty_ (use the local language of the feature) |
535 | **After Changes:** | run `nominatim refresh --website` |
537 Nominatim localizes the place names in responses when the corresponding
538 translation is available. Users can request a custom language setting through
539 the HTTP accept-languages header or through the explicit parameter
540 [accept-languages](../api/Search.md#language-of-results). If neither is
541 given, it falls back to this setting. If the setting is also empty, then
542 the local languages (in OSM: the name tag without any language suffix) is
546 #### NOMINATIM_LOOKUP_MAX_COUNT
549 | -------------- | --------------------------------------------------- |
550 | **Description:** | Maximum number of OSM ids accepted by /lookup |
551 | **Format:** | integer |
552 | **Default:** | 50 |
553 | **After Changes:** | run `nominatim refresh --website` |
555 The /lookup point accepts list of ids to look up address details for. This
556 setting restricts the number of places a user may look up with a single
560 #### NOMINATIM_POLYGON_OUTPUT_MAX_TYPES
563 | -------------- | --------------------------------------------------- |
564 | **Description:** | Number of different geometry formats that may be returned |
565 | **Format:** | integer |
567 | **After Changes:** | run `nominatim refresh --website` |
569 Nominatim supports returning full geometries of places. The geometries may
570 be requested in different formats with one of the
571 [`polygon_*` parameters](../api/Search.md#polygon-output). Use this
572 setting to restrict the number of geometry types that may be requested
575 Setting this parameter to 0 disables polygon output completely.
578 #### NOMINATIM_SEARCH_WITHIN_COUNTRIES
581 | -------------- | --------------------------------------------------- |
582 | **Description:** | Disable search for elements that are not in the country grid |
583 | **Format:** | boolean |
584 | **Default:** | no |
585 | **After Changes:** | run `nominatim refresh --website` |
587 Enable to search elements just within countries.
589 When enabled, if, despite not finding a point within the static grid of countries, it
590 finds a geometry of a region, do not return the geometry.
591 Return "Unable to geocode" instead.
594 #### NOMINATIM_SERVE_LEGACY_URLS
597 | -------------- | --------------------------------------------------- |
598 | **Description:** | Enable serving via URLs with a .php suffix |
599 | **Format:** | boolean |
600 | **Default:** | yes |
601 | **Comment:** | Python frontend only |
603 When enabled, then endpoints are reachable as `/<name>` as well as `/<name>.php`.
604 This can be useful when you want to be backwards-compatible with previous
605 versions of Nominatim.
608 #### NOMINATIM_API_POOL_SIZE
611 | -------------- | --------------------------------------------------- |
612 | **Description:** | Number of parallel database connections per worker |
613 | **Format:** | number |
614 | **Default:** | 10 |
615 | **Comment:** | Python frontend only |
617 Sets the maximum number of database connections available for a single instance
618 of Nominatim. When configuring the maximum number of connections that your
619 PostgreSQL database can handle, you need at least
620 `NOMINATIM_API_POOL_SIZE` * `<number of configured workers>` connections.
621 For configuring the number of workers, refer to the section about
622 [Deploying the Python frontend](../admin/Deployment-Python.md).
624 #### NOMINATIM_QUERY_TIMEOUT
627 | -------------- | --------------------------------------------------- |
628 | **Description:** | Timeout for SQL queries to the database |
629 | **Format:** | number (seconds) |
630 | **Default:** | 10 |
631 | **Comment:** | Python frontend only |
633 When this timeout is set, then all SQL queries that run longer than the
634 specified numbers of seconds will be cancelled and the user receives a
635 timeout exceptions. Users of the API see a 503 HTTP error.
637 The timeout does ont apply when using the
638 [low-level DB access](../library/Low-Level-DB-Access.md)
639 of the library. A timeout can be manually set, if required.
642 #### NOMINATIM_REQUEST_TIMEOUT
645 | -------------- | --------------------------------------------------- |
646 | **Description:** | Timeout for search queries |
647 | **Format:** | number (seconds) |
648 | **Default:** | 60 |
649 | **Comment:** | Python frontend only |
651 When this timeout is set, a search query will finish sending queries
652 to the database after the timeout has passed and immediately return the
653 results gathered so far.
655 Note that under high load you may observe that users receive different results
656 than usual without seeing an error. This may cause some confusion.
660 #### NOMINATIM_LOG_DB
663 | -------------- | --------------------------------------------------- |
664 | **Description:** | Log requests into the database |
665 | **Format:** | boolean |
666 | **Default:** | no |
667 | **After Changes:** | run `nominatim refresh --website` |
669 Enable logging requests into a database table with this setting. The logs
670 can be found in the table `new_query_log`.
672 When using this logging method, it is advisable to set up a job that
673 regularly clears out old logging information. Nominatim will not do that
676 Can be used as the same time as NOMINATIM_LOG_FILE.
678 #### NOMINATIM_LOG_FILE
681 | -------------- | --------------------------------------------------- |
682 | **Description:** | Log requests into a file |
683 | **Format:** | path |
684 | **Default:** | _empty_ (logging disabled) |
685 | **After Changes:** | run `nominatim refresh --website` |
687 Enable logging of requests into a file with this setting by setting the log
688 file where to log to. A relative file name is assumed to be relative to
689 the project directory.
692 The entries in the log file have the following format:
694 <request time> <execution time in s> <number of results> <type> "<query string>"
696 Request time is the time when the request was started. The execution time is
697 given in seconds and includes the entire time the query was queued and executed
699 type contains the name of the endpoint used.
701 Can be used as the same time as NOMINATIM_LOG_DB.
703 #### NOMINATIM_DEBUG_SQL
706 | -------------- | --------------------------------------------------- |
707 | **Description:** | Enable printing of raw SQL by SQLAlchemy |
708 | **Format:** | boolean |
709 | **Default:** | no |
710 | **Comment:** | **For developers only.** |
712 This settings enables
713 [SQL debugging](https://docs.sqlalchemy.org/en/20/core/engines.html#dbengine-logging)
714 by SQLAlchemy. This can be helpful when debugging some bugs with internal
715 query handling. It should only be used together with the CLI query functions.
716 Enabling it for server mode may have unintended consequences. Use the `debug`
717 parameter instead, which prints information on how the search is executed
718 including SQL statements.