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_TOKENIZER
70 | -------------- | --------------------------------------------------- |
71 | **Description:** | Tokenizer used for normalizing and parsing queries and names |
72 | **Format:** | string |
73 | **Default:** | icu |
74 | **After Changes:** | cannot be changed after import |
76 Sets the tokenizer type to use for the import. For more information on
77 available tokenizers and how they are configured, see
78 [Tokenizers](../customize/Tokenizers.md).
81 #### NOMINATIM_TOKENIZER_CONFIG
84 | -------------- | --------------------------------------------------- |
85 | **Description:** | Configuration file for the tokenizer |
86 | **Format:** | path |
87 | **Default:** | _empty_ (default file depends on tokenizer) |
88 | **After Changes:** | see documentation for each tokenizer |
90 Points to the file with additional configuration for the tokenizer.
91 See the [Tokenizer](../customize/Tokenizers.md) descriptions for details
94 If a relative path is given, then the file is searched first relative to the
95 project directory and then in the global settings directory.
98 #### NOMINATIM_LIMIT_REINDEXING
101 | -------------- | --------------------------------------------------- |
102 | **Description:** | Avoid invalidating large areas |
103 | **Format:** | bool |
104 | **Default:** | yes |
106 Nominatim computes the address of each place at indexing time. This has the
107 advantage to make search faster but also means that more objects needs to
108 be invalidated when the data changes. For example, changing the name of
109 the state of Florida would require recomputing every single address point
110 in the state to make the new name searchable in conjunction with addresses.
112 Setting this option to 'yes' means that Nominatim skips reindexing of contained
113 objects when the area becomes too large.
116 #### NOMINATIM_LANGUAGES
119 | -------------- | --------------------------------------------------- |
120 | **Description:** | Restrict search languages |
121 | **Format:** | string: comma-separated list of language codes |
122 | **Default:** | _empty_ |
124 Normally Nominatim will include all language variants of name:XX
125 in the search index. Set this to a comma separated list of language
126 codes, to restrict import to a subset of languages.
128 Currently only affects the initial import of country names and special phrases.
131 #### NOMINATIM_USE_US_TIGER_DATA
134 | -------------- | --------------------------------------------------- |
135 | **Description:** | Enable searching for Tiger house number data |
136 | **Format:** | boolean |
137 | **Default:** | no |
138 | **After Changes:** | run `nominatim refresh --functions` |
140 When this setting is enabled, search and reverse queries also take data
141 from [Tiger house number data](Tiger.md) into account.
144 #### NOMINATIM_USE_AUX_LOCATION_DATA
147 | -------------- | --------------------------------------------------- |
148 | **Description:** | Enable searching in external house number tables |
149 | **Format:** | boolean |
150 | **Default:** | no |
151 | **After Changes:** | run `nominatim refresh --functions` |
152 | **Comment:** | Do not use. |
154 When this setting is enabled, search queries also take data from external
155 house number tables into account.
157 *Warning:* This feature is currently unmaintained and should not be used.
160 #### NOMINATIM_HTTP_PROXY
163 | -------------- | --------------------------------------------------- |
164 | **Description:** | Use HTTP proxy when downloading data |
165 | **Format:** | boolean |
166 | **Default:** | no |
168 When this setting is enabled and at least
169 [NOMINATIM_HTTP_PROXY_HOST](#nominatim_http_proxy_host) and
170 [NOMINATIM_HTTP_PROXY_PORT](#nominatim_http_proxy_port) are set, the
171 configured proxy will be used, when downloading external data like
175 #### NOMINATIM_HTTP_PROXY_HOST
178 | -------------- | --------------------------------------------------- |
179 | **Description:** | Host name of the proxy to use |
180 | **Format:** | string |
181 | **Default:** | _empty_ |
183 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, this setting
184 configures the proxy host name.
187 #### NOMINATIM_HTTP_PROXY_PORT
190 | -------------- | --------------------------------------------------- |
191 | **Description:** | Port number of the proxy to use |
192 | **Format:** | integer |
193 | **Default:** | 3128 |
195 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, this setting
196 configures the port number to use with the proxy.
199 #### NOMINATIM_HTTP_PROXY_LOGIN
202 | -------------- | --------------------------------------------------- |
203 | **Description:** | Username for proxies that require login |
204 | **Format:** | string |
205 | **Default:** | _empty_ |
207 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, use this
208 setting to define the username for proxies that require a login.
211 #### NOMINATIM_HTTP_PROXY_PASSWORD
214 | -------------- | --------------------------------------------------- |
215 | **Description:** | Password for proxies that require login |
216 | **Format:** | string |
217 | **Default:** | _empty_ |
219 When [NOMINATIM_HTTP_PROXY](#nominatim_http_proxy) is enabled, use this
220 setting to define the password for proxies that require a login.
223 #### NOMINATIM_OSM2PGSQL_BINARY
226 | -------------- | --------------------------------------------------- |
227 | **Description:** | Location of the osm2pgsql binary |
228 | **Format:** | path |
229 | **Default:** | _empty_ (use binary shipped with Nominatim) |
230 | **Comment:** | EXPERT ONLY |
232 Nominatim uses [osm2pgsql](https://osm2pgsql.org) to load the OSM data
233 initially into the database. Nominatim comes bundled with a version of
234 osm2pgsql that is guaranteed to be compatible. Use this setting to use
235 a different binary instead. You should do this only when you know exactly
236 what you are doing. If the osm2pgsql version is not compatible, then the
240 #### NOMINATIM_WIKIPEDIA_DATA_PATH
243 | -------------- | --------------------------------------------------- |
244 | **Description:** | Directory with the wikipedia importance data |
245 | **Format:** | path |
246 | **Default:** | _empty_ (project directory) |
248 Set a custom location for the
249 [wikipedia ranking file](../admin/Import.md#wikipediawikidata-rankings). When
250 unset, Nominatim expects the data to be saved in the project directory.
252 #### NOMINATIM_ADDRESS_LEVEL_CONFIG
255 | -------------- | --------------------------------------------------- |
256 | **Description:** | Configuration file for rank assignments |
257 | **Format:** | path |
258 | **Default:** | address-levels.json |
260 The _address level configuration_ defines the rank assignments for places. See
261 [Place Ranking](Ranking.md) for a detailed explanation what rank assignments
262 are and what the configuration file must look like.
264 When a relative path is given, then the file is searched first relative to the
265 project directory and then in the global settings directory.
268 #### NOMINATIM_IMPORT_STYLE
271 | -------------- | --------------------------------------------------- |
272 | **Description:** | Configuration to use for the initial OSM data import |
273 | **Format:** | string or path |
274 | **Default:** | extratags |
276 The _style configuration_ describes which OSM objects and tags are taken
277 into consideration for the search database. Nominatim comes with a set
278 of pre-configured styles, that may be configured here.
280 You can also write your own custom style and point the setting to the file
281 with the style. When a relative path is given, then the style file is searched
282 first relative to the project directory and then in the global settings
285 See [Import Styles](Import-Styles.md)
286 for more information on the available internal styles and the format of the
289 #### NOMINATIM_FLATNODE_FILE
292 | -------------- | --------------------------------------------------- |
293 | **Description:** | Location of osm2pgsql flatnode file |
294 | **Format:** | path |
295 | **Default:** | _empty_ (do not use a flatnote file) |
296 | **After Changes:** | Only change when moving the file physically. |
298 The `osm2pgsql flatnode file` is file that efficiently stores geographic
299 location for OSM nodes. For larger imports it can significantly speed up
300 the import. When this option is unset, then osm2pgsql uses a PsotgreSQL table
301 to store the locations.
303 When a relative path is given, then the flatnode file is created/searched
304 relative to the project directory.
308 The flatnode file is not only used during the initial import but also
309 when adding new data with `nominatim add-data` or `nominatim replication`.
310 Make sure you keep the flatnode file around and this setting unmodified,
311 if you plan to add more data or run regular updates.
314 #### NOMINATIM_TABLESPACE_*
317 | -------------- | --------------------------------------------------- |
318 | **Description:** | Group of settings for distributing the database over tablespaces |
319 | **Format:** | string |
320 | **Default:** | _empty_ (do not use a table space) |
321 | **After Changes:** | no effect after initial import |
323 Nominatim allows to distribute the search database over up to 10 different
324 [PostgreSQL tablespaces](https://www.postgresql.org/docs/current/manage-ag-tablespaces.html).
325 If you use this option, make sure that the tablespaces exist before starting
328 The available tablespace groups are:
330 NOMINATIM_TABLESPACE_SEARCH_DATA
331 : Data used by the geocoding frontend.
333 NOMINATIM_TABLESPACE_SEARCH_INDEX
334 : Indexes used by the geocoding frontend.
336 NOMINATIM_TABLESPACE_OSM_DATA
337 : Raw OSM data cache used for import and updates.
339 NOMINATIM_TABLESPACE_OSM_DATA
340 : Indexes on the raw OSM data cache.
342 NOMINATIM_TABLESPACE_PLACE_DATA
343 : Data table with the pre-filtered but still unprocessed OSM data.
344 Used only during imports and updates.
346 NOMINATIM_TABLESPACE_PLACE_INDEX
347 : Indexes on raw data table. Used only during imports and updates.
349 NOMINATIM_TABLESPACE_ADDRESS_DATA
350 : Data tables used for computing search terms and addresses of places
351 during import and updates.
353 NOMINATIM_TABLESPACE_ADDRESS_INDEX
354 : Indexes on the data tables for search term and address computation.
355 Used only for import and updates.
357 NOMINATIM_TABLESPACE_AUX_DATA
358 : Auxiliary data tables for non-OSM data, e.g. for Tiger house number data.
360 NOMINATIM_TABLESPACE_AUX_INDEX
361 : Indexes on auxiliary data tables.
364 ### Replication Update Settings
366 #### NOMINATIM_REPLICATION_URL
369 | -------------- | --------------------------------------------------- |
370 | **Description:** | Base URL of the replication service |
371 | **Format:** | url |
372 | **Default:** | https://planet.openstreetmap.org/replication/minute |
373 | **After Changes:** | run `nominatim replication --init` |
375 Replication services deliver updates to OSM data. Use this setting to choose
376 which replication service to use. See [Updates](../admin/Update.md) for more
377 information on how to set up regular updates.
379 #### NOMINATIM_REPLICATION_MAX_DIFF
382 | -------------- | --------------------------------------------------- |
383 | **Description:** | Maximum amount of data to download per update cycle (in MB) |
384 | **Format:** | integer |
385 | **Default:** | 50 |
386 | **After Changes:** | restart the replication process |
388 At each update cycle Nominatim downloads diffs until either no more diffs
389 are available on the server (i.e. the database is up-to-date) or the limit
390 given in this setting is exceeded. Nominatim guarantees to downloads at least
391 one diff, if one is available, no matter how small the setting.
393 The default for this setting is fairly conservative because Nominatim keeps
394 all data downloaded in one cycle in RAM. Using large values in a production
395 server may interfere badly with the search frontend because it evicts data
396 from RAM that is needed for speedy answers to incoming requests. It is usually
397 a better idea to keep this setting lower and run multiple update cycles
398 to catch up with updates.
400 When catching up in non-production mode, for example after the initial import,
401 the setting can easily be changed temporarily on the command line:
403 NOMINATIM_REPLICATION_MAX_DIFF=3000 nominatim replication
406 #### NOMINATIM_REPLICATION_UPDATE_INTERVAL
409 | -------------- | --------------------------------------------------- |
410 | **Description:** | Publication interval of the replication service (in seconds) |
411 | **Format:** | integer |
412 | **Default:** | 75 |
413 | **After Changes:** | restart the replication process |
415 This setting determines when Nominatim will attempt to download again a new
416 update. The time is computed from the publication date of the last diff
417 downloaded. Setting this to a slightly higher value than the actual
418 publication interval avoids unnecessary rechecks.
421 #### NOMINATIM_REPLICATION_RECHECK_INTERVAL
424 | -------------- | --------------------------------------------------- |
425 | **Description:** | Wait time to recheck for a pending update (in seconds) |
426 | **Format:** | integer |
427 | **Default:** | 60 |
428 | **After Changes:** | restart the replication process |
430 When replication updates are run in continuous mode (using `nominatim replication`),
431 this setting determines how long Nominatim waits until it looks for updates
432 again when updates were not available on the server.
434 Note that this is different from
435 [NOMINATIM_REPLICATION_UPDATE_INTERVAL](#nominatim_replication_update_interval).
436 Nominatim will never attempt to query for new updates for UPDATE_INTERVAL
437 seconds after the current database date. Only after the update interval has
438 passed it asks for new data. If then no new data is found, it waits for
439 RECHECK_INTERVAL seconds before it attempts again.
443 #### NOMINATIM_CORS_NOACCESSCONTROL
446 | -------------- | --------------------------------------------------- |
447 | **Description:** | Send permissive CORS access headers |
448 | **Format:** | boolean |
449 | **Default:** | yes |
450 | **After Changes:** | run `nominatim refresh --website` |
452 When this setting is enabled, API HTTP responses include the HTTP
453 [CORS](https://en.wikipedia.org/wiki/CORS) headers
454 `access-control-allow-origin: *` and `access-control-allow-methods: OPTIONS,GET`.
456 #### NOMINATIM_MAPICON_URL
459 | -------------- | --------------------------------------------------- |
460 | **Description:** | URL prefix for static icon images |
461 | **Format:** | url |
462 | **Default:** | _empty_ |
463 | **After Changes:** | run `nominatim refresh --website` |
465 When a mapicon URL is configured, then Nominatim includes an additional `icon`
466 field in the responses, pointing to an appropriate icon for the place type.
468 Map icons used to be included in Nominatim itself but now have moved to the
469 [nominatim-ui](https://github.com/osm-search/nominatim-ui/) project. If you
470 want the URL to be included in API responses, make the `/mapicon`
471 directory of the project available under a public URL and point this setting
475 #### NOMINATIM_DEFAULT_LANGUAGE
478 | -------------- | --------------------------------------------------- |
479 | **Description:** | Language of responses when no language is requested |
480 | **Format:** | language code |
481 | **Default:** | _empty_ (use the local language of the feature) |
482 | **After Changes:** | run `nominatim refresh --website` |
484 Nominatim localizes the place names in responses when the corresponding
485 translation is available. Users can request a custom language setting through
486 the HTTP accept-languages header or through the explicit parameter
487 [accept-languages](../api/Search.md#language-of-results). If neither is
488 given, it falls back to this setting. If the setting is also empty, then
489 the local languages (in OSM: the name tag without any language suffix) is
493 #### NOMINATIM_LOOKUP_MAX_COUNT
496 | -------------- | --------------------------------------------------- |
497 | **Description:** | Maximum number of OSM ids accepted by /lookup |
498 | **Format:** | integer |
499 | **Default:** | 50 |
500 | **After Changes:** | run `nominatim refresh --website` |
502 The /lookup point accepts list of ids to look up address details for. This
503 setting restricts the number of places a user may look up with a single
507 #### NOMINATIM_POLYGON_OUTPUT_MAX_TYPES
510 | -------------- | --------------------------------------------------- |
511 | **Description:** | Number of different geometry formats that may be returned |
512 | **Format:** | integer |
514 | **After Changes:** | run `nominatim refresh --website` |
516 Nominatim supports returning full geometries of places. The geometries may
517 be requested in different formats with one of the
518 [`polygon_*` parameters](../api/Search.md#polygon-output). Use this
519 setting to restrict the number of geometry types that may be requested
522 Setting this parameter to 0 disables polygon output completely.
525 #### NOMINATIM_SEARCH_WITHIN_COUNTRIES
528 | -------------- | --------------------------------------------------- |
529 | **Description:** | Disable search for elements that are not in the country grid |
530 | **Format:** | boolean |
531 | **Default:** | no |
532 | **After Changes:** | run `nominatim refresh --website` |
534 Enable to search elements just within countries.
536 When enabled, if, despite not finding a point within the static grid of countries, it
537 finds a geometry of a region, do not return the geometry.
538 Return "Unable to geocode" instead.
541 #### NOMINATIM_SERVE_LEGACY_URLS
544 | -------------- | --------------------------------------------------- |
545 | **Description:** | Enable serving via URLs with a .php suffix |
546 | **Format:** | boolean |
547 | **Default:** | yes |
548 | **Comment:** | Python frontend only |
550 When enabled, then endpoints are reachable as `/<name>` as well as `/<name>.php`.
551 This can be useful when you want to be backwards-compatible with previous
552 versions of Nominatim.
555 #### NOMINATIM_API_POOL_SIZE
558 | -------------- | --------------------------------------------------- |
559 | **Description:** | Number of parallel database connections per worker |
560 | **Format:** | number |
561 | **Default:** | 10 |
562 | **Comment:** | Python frontend only |
564 Sets the maximum number of database connections available for a single instance
565 of Nominatim. When configuring the maximum number of connections that your
566 PostgreSQL database can handle, you need at least
567 `NOMINATIM_API_POOL_SIZE` * `<number of configured workers>` connections.
568 For configuring the number of workers, refer to the section about
569 [Deploying the Python frontend](../admin/Deployment-Python.md).
571 #### NOMINATIM_QUERY_TIMEOUT
574 | -------------- | --------------------------------------------------- |
575 | **Description:** | Timeout for SQL queries to the database |
576 | **Format:** | number (seconds) |
577 | **Default:** | 10 |
578 | **Comment:** | Python frontend only |
580 When this timeout is set, then all SQL queries that run longer than the
581 specified numbers of seconds will be cancelled and the user receives a
582 timeout exceptions. Users of the API see a 503 HTTP error.
584 The timeout does ont apply when using the
585 [low-level DB access](../library/Low-Level-DB-Access.md)
586 of the library. A timeout can be manually set, if required.
589 #### NOMINATIM_REQUEST_TIMEOUT
592 | -------------- | --------------------------------------------------- |
593 | **Description:** | Timeout for search queries |
594 | **Format:** | number (seconds) |
595 | **Default:** | 60 |
596 | **Comment:** | Python frontend only |
598 When this timeout is set, a search query will finish sending queries
599 to the database after the timeout has passed and immediately return the
600 results gathered so far.
602 Note that under high load you may observe that users receive different results
603 than usual without seeing an error. This may cause some confusion.
607 #### NOMINATIM_LOG_DB
610 | -------------- | --------------------------------------------------- |
611 | **Description:** | Log requests into the database |
612 | **Format:** | boolean |
613 | **Default:** | no |
614 | **After Changes:** | run `nominatim refresh --website` |
616 Enable logging requests into a database table with this setting. The logs
617 can be found in the table `new_query_log`.
619 When using this logging method, it is advisable to set up a job that
620 regularly clears out old logging information. Nominatim will not do that
623 Can be used as the same time as NOMINATIM_LOG_FILE.
625 #### NOMINATIM_LOG_FILE
628 | -------------- | --------------------------------------------------- |
629 | **Description:** | Log requests into a file |
630 | **Format:** | path |
631 | **Default:** | _empty_ (logging disabled) |
632 | **After Changes:** | run `nominatim refresh --website` |
634 Enable logging of requests into a file with this setting by setting the log
635 file where to log to. A relative file name is assumed to be relative to
636 the project directory.
639 The entries in the log file have the following format:
641 <request time> <execution time in s> <number of results> <type> "<query string>"
643 Request time is the time when the request was started. The execution time is
644 given in seconds and includes the entire time the query was queued and executed
646 type contains the name of the endpoint used.
648 Can be used as the same time as NOMINATIM_LOG_DB.
650 #### NOMINATIM_DEBUG_SQL
653 | -------------- | --------------------------------------------------- |
654 | **Description:** | Enable printing of raw SQL by SQLAlchemy |
655 | **Format:** | boolean |
656 | **Default:** | no |
657 | **Comment:** | **For developers only.** |
659 This settings enables
660 [SQL debugging](https://docs.sqlalchemy.org/en/20/core/engines.html#dbengine-logging)
661 by SQLAlchemy. This can be helpful when debugging some bugs with internal
662 query handling. It should only be used together with the CLI query functions.
663 Enabling it for server mode may have unintended consequences. Use the `debug`
664 parameter instead, which prints information on how the search is executed
665 including SQL statements.