Compare commits

..

1 Commits

Author SHA1 Message Date
Sarah Hoffmann
4e79533f1f adapt docs for release 2025-02-05 12:08:33 +01:00
549 changed files with 10855 additions and 12958 deletions

View File

@@ -6,6 +6,3 @@ extend-ignore =
E711
per-file-ignores =
__init__.py: F401
test/python/utils/test_json_writer.py: E131
**/conftest.py: E402
test/bdd/*: F821

View File

@@ -11,8 +11,10 @@ runs:
steps:
- name: Remove existing PostgreSQL
run: |
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
sudo apt-get purge -yq postgresql*
sudo apt install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update -qq
shell: bash

View File

@@ -37,20 +37,18 @@ jobs:
needs: create-archive
strategy:
matrix:
flavour: ["ubuntu-22", "ubuntu-24"]
flavour: ["ubuntu-20", "ubuntu-24"]
include:
- flavour: ubuntu-22
ubuntu: 22
- flavour: ubuntu-20
ubuntu: 20
postgresql: 12
lua: '5.1'
dependencies: pip
python: '3.9'
- flavour: ubuntu-24
ubuntu: 24
postgresql: 18
postgresql: 17
lua: '5.3'
dependencies: apt
python: 'builtin'
runs-on: ubuntu-${{ matrix.ubuntu }}.04
@@ -70,40 +68,26 @@ jobs:
with:
dependencies: ${{ matrix.dependencies }}
- uses: actions/cache@v4
with:
path: |
/usr/local/bin/osm2pgsql
key: osm2pgsql-bin-22-1
if: matrix.ubuntu == '22'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
if: matrix.python != 'builtin'
- name: Compile osm2pgsql
run: |
if [ ! -f /usr/local/bin/osm2pgsql ]; then
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev liblua${LUA_VERSION}-dev lua-dkjson nlohmann-json3-dev
mkdir osm2pgsql-build
cd osm2pgsql-build
git clone https://github.com/osm2pgsql-dev/osm2pgsql
mkdir build
cd build
cmake ../osm2pgsql
make
sudo make install
cd ../..
rm -rf osm2pgsql-build
else
sudo apt-get install -y -qq libexpat1 liblua${LUA_VERSION}
fi
if: matrix.ubuntu == '22'
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev liblua${LUA_VERSION}-dev lua-dkjson nlohmann-json3-dev
mkdir osm2pgsql-build
cd osm2pgsql-build
git clone https://github.com/osm2pgsql-dev/osm2pgsql
mkdir build
cd build
cmake ../osm2pgsql
make
sudo make install
cd ../..
rm -rf osm2pgsql-build
if: matrix.ubuntu == '20'
env:
LUA_VERSION: ${{ matrix.lua }}
- name: Install test prerequisites
run: ./venv/bin/pip install behave==1.2.6
- name: Install test prerequisites (apt)
run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn python3-falcon python3-aiosqlite python3-pyosmium
if: matrix.dependencies == 'apt'
@@ -112,14 +96,11 @@ jobs:
run: ./venv/bin/pip install pytest-asyncio falcon starlette asgi_lifespan aiosqlite osmium uvicorn
if: matrix.dependencies == 'pip'
- name: Install test prerequisites
run: ./venv/bin/pip install pytest-bdd
- name: Install latest flake8
run: ./venv/bin/pip install -U flake8
- name: Python linting
run: ../venv/bin/python -m flake8 src test/python test/bdd
run: ../venv/bin/python -m flake8 src
working-directory: Nominatim
- name: Install mypy and typechecking info
@@ -127,7 +108,7 @@ jobs:
if: matrix.dependencies == 'pip'
- name: Python static typechecking
run: ../venv/bin/python -m mypy --strict --python-version 3.9 src
run: ../venv/bin/python -m mypy --strict --python-version 3.8 src
working-directory: Nominatim
if: matrix.dependencies == 'pip'
@@ -137,8 +118,8 @@ jobs:
- name: BDD tests
run: |
../venv/bin/python -m pytest test/bdd --nominatim-purge
working-directory: Nominatim
../../../venv/bin/python -m behave -DREMOVE_TEMPLATE=1 --format=progress3
working-directory: Nominatim/test/bdd
install:
runs-on: ubuntu-latest
@@ -326,7 +307,7 @@ jobs:
- uses: ./Nominatim/.github/actions/setup-postgresql
with:
postgresql-version: 18
postgresql-version: 17
- name: Install Python dependencies
run: |

View File

@@ -113,5 +113,3 @@ Checklist for releases:
* run `nominatim --version` to confirm correct version
* [ ] tag new release and add a release on github.com
* [ ] build pip packages and upload to pypi
* `make build`
* `twine upload dist/*`

View File

@@ -1,58 +1,3 @@
5.2.0
* increase minimum required Python to 3.9
* index and output entrances of buildings and areas (thanks @emlove)
* name tags used for creating display names are now configurable
(thanks @astridx)
* new pattern-replacement query preprocessor (thanks @TuringVerified)
* special phrases can now be filtered by presence of tags (thanks @anqixxx)
* lua import style now always includes tags required by Nominatim
* improved query time reporting and logging
* improve word matching for languages with no word boundaries
* POIs with addresses inherited from surrounding building are no
longer returned in the address layer
* avoid creating a directory for the tokenizer when not needed
* replace behave with pytest-bdd for BDD testing
* refactoring and performance improvements to query parsing
* various smaller updates to styles
* remove English as default language for South Korea
* remove Japanese word variants
* updated country names for Norwegians (thanks @Johannes-Andersen)
* remove support for deprecated osm2pgsql gazetteer style
* fix updating of importances (also needs to update search_name table)
* fix query for deletable endpoint to use index again
* fix reindexing of contained places when a boundary is deleted and reinstated
* fix difference computation error when updating postcodes
* bracket handling sanitizer no longer strips bracket terms in the middle of
name
* reduce precision of stored coordinates to 7-digits everywhere
* avoid ST_Relate as it seems buggy on some systems
* remove setting for logging queries in DB, no longer functional
* postcode updates no longer require a project directory (needed for tests)
* refactor locale handling code (thanks @anqixxx)
* code updates for newer Python (thanks @emmanuel-ferdman)
* better test coverage (thanks @asharmalik19)
* various fixes and improvements to documentation
(thanks @anqixxx, @dave-meyer, @hasandiwan)
5.1.0
* replace datrie with simple internal trie implementation
* add pattern-based postcode parser for queries,
postcodes no longer need to be present in OSM to be found
* take variants into account when computing token similarity
* add extratags output to geocodejson format
* fix default layer setting used for structured queries
* update abbreviation lists for Russian and English
(thanks @shoorick, @IvanShift, @mhsrn21)
* fix variant generation for Norwegian
* fix normalization around space-like characters
* improve postcode search and handling of postcodes in queries
* reorganise internal query structure and get rid of slow enums
* enable code linting for tests
* various code moderinsations in test code (thanks @eumiro)
* remove setting osm2pgsql location via config.lib_dir
* make SQL functions parallel save as far as possible (thanks @otbutz)
* various fixes and improvements to documentation (thanks @TuringVerified)
5.0.0
* increase required versions for PostgreSQL (12+), PostGIS (3.0+)
* remove installation via cmake and debundle osm2pgsql

View File

@@ -18,16 +18,16 @@ build-api:
tests: mypy lint pytest bdd
mypy:
mypy --strict --python-version 3.9 src
mypy --strict --python-version 3.8 src
pytest:
pytest test/python
lint:
flake8 src test/python test/bdd
flake8 src
bdd:
pytest test/bdd --nominatim-purge
cd test/bdd; behave -DREMOVE_TEMPLATE=1
# Documentation

View File

@@ -27,25 +27,18 @@ can be found at nominatim.org as well.
A quick summary of the necessary steps:
1. Clone this git repository and download the country grid
git clone https://github.com/osm-search/Nominatim.git
wget -O Nominatim/data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
2. Create a Python virtualenv and install the packages:
1. Create a Python virtualenv and install the packages:
python3 -m venv nominatim-venv
./nominatim-venv/bin/pip install packaging/nominatim-{api,db}
3. Create a project directory, get OSM data and import:
2. Create a project directory, get OSM data and import:
mkdir nominatim-project
cd nominatim-project
../nominatim-venv/bin/nominatim import --osm-file <your planet file> 2>&1 | tee setup.log
../nominatim-venv/bin/nominatim import --osm-file <your planet file>
4. Start the webserver:
3. Start the webserver:
./nominatim-venv/bin/pip install uvicorn falcon
../nominatim-venv/bin/nominatim serve

View File

@@ -9,11 +9,10 @@ versions.
| Version | End of support for security updates |
| ------- | ----------------------------------- |
| 5.2.x | 2027-10-29 |
| 5.1.x | 2027-04-01 |
| 5.0.x | 2027-02-06 |
| 5.0.x | 2027-02-06
| 4.5.x | 2026-09-12 |
| 4.4.x | 2026-03-07 |
| 4.3.x | 2025-09-07 |
## Reporting a Vulnerability
@@ -32,7 +31,8 @@ description of the nature and severity of the issue. **
Patches for identified security issues are applied to all affected versions and
new minor versions are released. At the same time we release a statement at
the [Nominatim blog](https://nominatim.org/blog/) describing the nature of the
incident.
incident. Announcements will also be published at the
[geocoding mailinglist](https://lists.openstreetmap.org/listinfo/geocoding).
## List of Previous Incidents

View File

@@ -27,7 +27,7 @@ For running Nominatim:
* [PostgreSQL](https://www.postgresql.org) (12+ will work, 13+ strongly recommended)
* [PostGIS](https://postgis.net) (3.0+ will work, 3.2+ strongly recommended)
* [osm2pgsql](https://osm2pgsql.org) (1.8+)
* [Python 3](https://www.python.org/) (3.9+)
* [Python 3](https://www.python.org/) (3.7+)
Furthermore the following Python libraries are required:
@@ -37,6 +37,7 @@ Furthermore the following Python libraries are required:
* [Jinja2](https://palletsprojects.com/p/jinja/)
* [PyICU](https://pypi.org/project/PyICU/)
* [PyYaml](https://pyyaml.org/) (5.1+)
* [datrie](https://github.com/pytries/datrie)
These will be installed automatically when using pip installation.
@@ -115,7 +116,7 @@ Then you can install Nominatim with:
The following instructions are only relevant, if you want to build and
install Nominatim **from source**.
### Downloading the latest release
### Downloading the source for the latest release
You can download the [latest release from nominatim.org](https://nominatim.org/downloads/).
The release contains all necessary files. Just unpack it.

View File

@@ -17,18 +17,6 @@ breaking changes. **Please read them before running the migration.**
and migrate to 4.3 first. Then you can migrate to the current
version. It is strongly recommended to do a reimport instead.
## 5.1.0 -> 5.2.0
### Lua import style: required extratags removed
Tags that are required by Nominatim as extratags are now always included
independent of what is defined in the style. The line
flex.add_for_extratags('required')
is no longer required in custom styles and will throw an error. Simply
remove the line from your style.
## 4.5.0 -> 5.0.0
### PHP frontend removed

View File

@@ -36,11 +36,11 @@ The website is now available at `http://localhost:8765`.
## Forwarding searches to nominatim-ui
Nominatim used to provide the search interface directly by itself when
`format=html` was requested. For the `/search` endpoint this even used
to be the default.
`format=html` was requested. For all endpoints except for `/reverse` and
`/lookup` this even used to be the default.
The following section describes how to set up Apache or nginx, so that your
users are forwarded to nominatim-ui when they go to a URL that formerly presented
users are forwarded to nominatim-ui when they go to URL that formerly presented
the UI.
### Setting up forwarding in Nginx
@@ -73,28 +73,41 @@ map $args $format {
# Determine from the URI and the format parameter above if forwarding is needed.
map $uri/$format $forward_to_ui {
default 0; # no forwarding by default
~/search.*/default 1; # Use this line only, if search should go to UI by default.
~/reverse.*/html 1; # Forward API calls that UI supports, when
~/status.*/html 1; # format=html is explicitly requested.
~/search.*/html 1;
~/details.*/html 1;
default 1; # The default is to forward.
~^/ui 0; # If the URI point to the UI already, we are done.
~/other$ 0; # An explicit non-html format parameter. No forwarding.
~/reverse.*/default 0; # Reverse and lookup assume xml format when
~/lookup.*/default 0; # no format parameter is given. No forwarding.
}
```
The `$forward_to_ui` parameter can now be used to conditionally forward the
calls:
``` nginx
location / {
if ($forward_to_ui) {
rewrite ^(/[^/.]*) https://$http_host/ui$1.html redirect;
}
```
# When no endpoint is given, default to search.
# Need to add a rewrite so that the rewrite rules below catch it correctly.
rewrite ^/$ /search;
# proxy_pass commands
location @php {
# fastcgi stuff..
if ($forward_to_ui) {
rewrite ^(/[^/]*) https://yourserver.com/ui$1.html redirect;
}
}
location ~ [^/]\.php(/|$) {
# fastcgi stuff..
if ($forward_to_ui) {
rewrite (.*).php https://yourserver.com/ui$1.html redirect;
}
}
```
!!! warning
Be aware that the rewrite commands are slightly different for URIs with and
without the .php suffix.
Reload nginx and the UI should be available.
### Setting up forwarding in Apache
@@ -146,16 +159,18 @@ directory like this:
RewriteBase "/nominatim/"
# If no endpoint is given, then use search.
RewriteRule ^(/|$) "search"
RewriteRule ^(/|$) "search.php"
# If format-html is explicitly requested, forward to the UI.
RewriteCond %{QUERY_STRING} "format=html"
RewriteRule ^([^/.]+) ui/$1.html [R,END]
RewriteRule ^([^/]+)(.php)? ui/$1.html [R,END]
# Optionally: if no format parameter is there then forward /search.
# If no format parameter is there then forward anything
# but /reverse and /lookup to the UI.
RewriteCond %{QUERY_STRING} "!format="
RewriteCond %{REQUEST_URI} "/search"
RewriteRule ^([^/.]+) ui/$1.html [R,END]
RewriteCond %{REQUEST_URI} "!/lookup"
RewriteCond %{REQUEST_URI} "!/reverse"
RewriteRule ^([^/]+)(.php)? ui/$1.html [R,END]
</Directory>
```

View File

@@ -105,13 +105,6 @@ grouped by type.
Include geometry of result.
| Parameter | Value | Default |
|-----------| ----- | ------- |
| entrances | 0 or 1 | 0 |
When set to 1, include the tagged entrances in the result.
### Language of results
| Parameter | Value | Default |

View File

@@ -49,7 +49,7 @@ Only has an effect for JSON output formats.
| Parameter | Value | Default |
|-----------| ----- | ------- |
| addressdetails | 0 or 1 | 1 |
| addressdetails | 0 or 1 | 0 |
When set to 1, include a breakdown of the address into elements.
The exact content of the address breakdown depends on the output format.
@@ -77,12 +77,6 @@ that is available in the database, e.g. wikipedia link, opening hours.
When set to 1, include a full list of names for the result. These may include
language variants, older names, references and brand.
| Parameter | Value | Default |
|-----------| ----- | ------- |
| entrances | 0 or 1 | 0 |
When set to 1, include the tagged entrances in the result.
### Language of results

View File

@@ -60,8 +60,6 @@ The possible fields are:
* `namedetails` - dictionary with full list of available names including ref etc.
* `geojson`, `svg`, `geotext`, `geokml` - full geometry
(only with the appropriate `polygon_*` parameter)
* `entrances` - array of objects representing tagged entrances for the object, or
null if none are found (only with `entrances=1`)
## JSONv2
@@ -89,8 +87,6 @@ The properties object has the following fields:
* `extratags` - dictionary with additional useful tags like `website` or `maxspeed`
(only with `extratags=1`)
* `namedetails` - dictionary with full list of available names including ref etc.
* `entrances` - array of objects representing tagged entrances for the object, or
null if none are found (only with `entrances=1`)
Use `polygon_geojson` to output the full geometry of the object instead
of the centroid.
@@ -110,13 +106,8 @@ The following feature attributes are implemented:
* `name` - localised name of the place
* `housenumber`, `street`, `locality`, `district`, `postcode`, `city`,
`county`, `state`, `country` -
provided when it can be determined from the address (only with `addressdetails=1`)
provided when it can be determined from the address
* `admin` - list of localised names of administrative boundaries (only with `addressdetails=1`)
* `extra` - dictionary with additional useful tags like `website` or `maxspeed`
(only with `extratags=1`)
* `entrances` - array of objects representing tagged entrances for the object, or
null if none are found (only with `entrances=1`)
Use `polygon_geojson` to output the full geometry of the object instead
of the centroid.
@@ -168,8 +159,8 @@ The place information can be found in the `result` element. The attributes of th
The full address of the result can be found in the content of the
`result` element as a comma-separated list.
Additional information requested with `addressdetails=1`, `extratags=1`,
`namedetails=1`, and `entrances=1` can be found in extra elements.
Additional information requested with `addressdetails=1`, `extratags=1` and
`namedetails=1` can be found in extra elements.
### Search and Lookup
@@ -230,9 +221,9 @@ be more than one. The attributes of that element contain:
When `addressdetails=1` is requested, the localised address parts appear
as subelements with the type of the address part.
Additional information requested with `extratags=1`, `namedetails=1`, and
`entrances=1` can be found in extra elements as sub-element of `extratags`,
`namedetails`, and `entrances` respectively.
Additional information requested with `extratags=1` and `namedetails=1` can
be found in extra elements as sub-element of `extratags` and `namedetails`
respectively.
## Notes on field values
@@ -309,78 +300,3 @@ with a designation label. Per default the following labels may appear:
They roughly correspond to the classification of the OpenStreetMap data
according to either the `place` tag or the main key of the object.
### entrances
Entrance details in the xml and json formats return the latitude and longitude
of the entrance, the osm node ID, the [type of
entrance](https://wiki.openstreetmap.org/wiki/Key:entrance), and any extra tags
associated with the entrance node.
* osm_id
* type
* lat
* lon
* extratags
They roughly correspond to the classification of the OpenStreetMap data
according to either the `place` tag or the main key of the object.
#### Example
##### JSON
[https://nominatim.openstreetmap.org/details?osmtype=W&osmid=32619803&entrances=1&format=json](https://nominatim.openstreetmap.org/details?osmtype=W&osmid=32619803&entrances=1&format=json)
```json
{
"place_id": 124325848,
"parent_place_id": 123936289,
"osm_type": "W",
"osm_id": 32619803,
"category": "shop",
"type": "supermarket",
"admin_level": 15,
"localname": "PENNY",
...
"entrances": [
{
"osm_id": 1733488238,
"type": "yes",
"lat": "51.0466704",
"lon": "12.8077106",
"extratags": {
"foot": "yes"
}
},
{
"osm_id": 1733488256,
"type": "main",
"lat": "51.0467197",
"lon": "12.8078448",
"extratags": {
"foot": "yes"
}
},
{
"osm_id": 1733498087,
"type": "exit",
"lat": "51.0467081",
"lon": "12.8078131",
"extratags": {
"foot": "yes"
}
},
{
"osm_id": 7914950851,
"type": "service",
"lat": "51.0468487",
"lon": "12.8075876",
"extratags": {
"access": "delivery"
}
}
]
}
```

View File

@@ -98,12 +98,6 @@ that is available in the database, e.g. wikipedia link, opening hours.
When set to 1, include a full list of names for the result. These may include
language variants, older names, references and brand.
| Parameter | Value | Default |
|-----------| ----- | ------- |
| entrances | 0 or 1 | 0 |
When set to 1, include the tagged entrances in the result.
### Language of results
@@ -152,7 +146,7 @@ In terms of address details the zoom levels are as follows:
| Parameter | Value | Default |
|-----------| ----- | ------- |
| layer | comma-separated list of: `address`, `poi`, `railway`, `natural`, `manmade` | `address,poi` |
| layer | comma-separated list of: `address`, `poi`, `railway`, `natural`, `manmade` | _unset_ (no restriction) |
The layer filter allows to select places by themes.
@@ -218,7 +212,7 @@ This overrides the specified machine readable format.
## Examples
* [https://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1&layer=address](https://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1&layer=address)
* [https://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1](https://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1)
```xml
<reversegeocode timestamp="Fri, 06 Nov 09 16:33:54 +0000" querystring="...">
@@ -241,7 +235,7 @@ This overrides the specified machine readable format.
##### Example with `format=jsonv2`
* [https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-34.44076&lon=-58.70521&layer=address](https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-34.44076&lon=-58.70521&layer=address)
* [https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-34.44076&lon=-58.70521](https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-34.44076&lon=-58.70521)
```json
{
@@ -273,7 +267,7 @@ This overrides the specified machine readable format.
##### Example with `format=geojson`
* [https://nominatim.openstreetmap.org/reverse?format=geojson&lat=44.50155&lon=11.33989&layer=address](https://nominatim.openstreetmap.org/reverse?format=geojson&lat=44.50155&lon=11.33989&layer=address)
* [https://nominatim.openstreetmap.org/reverse?format=geojson&lat=44.50155&lon=11.33989](https://nominatim.openstreetmap.org/reverse?format=geojson&lat=44.50155&lon=11.33989)
```json
{
@@ -325,7 +319,7 @@ This overrides the specified machine readable format.
##### Example with `format=geocodejson`
[https://nominatim.openstreetmap.org/reverse?format=geocodejson&lat=60.2299&lon=11.1663&layer=address](https://nominatim.openstreetmap.org/reverse?format=geocodejson&lat=60.2299&lon=11.1663&layer=address)
[https://nominatim.openstreetmap.org/reverse?format=geocodejson&lat=60.2299&lon=11.1663](https://nominatim.openstreetmap.org/reverse?format=geocodejson&lat=60.2299&lon=11.1663)
```json
{

View File

@@ -136,12 +136,6 @@ that is available in the database, e.g. wikipedia link, opening hours.
When set to 1, include a full list of names for the result. These may include
language variants, older names, references and brand.
| Parameter | Value | Default |
|-----------| ----- | ------- |
| entrances | 0 or 1 | 0 |
When set to 1, include the tagged entrances in the result.
### Language of results
@@ -218,7 +212,7 @@ other layers.
The featureType allows to have a more fine-grained selection for places
from the address layer. Results can be restricted to places that make up
the 'state', 'country' or 'city' part of an address. A featureType of
`settlement` selects any human inhabited feature from 'state' down to
settlement selects any human inhabited feature from 'state' down to
'neighbourhood'.
When featureType is set, then results are automatically restricted

View File

@@ -36,27 +36,18 @@ local flex = require('flex-base')
### Using preset configurations
If you want to start with one of the existing presets, then you can import
its settings using the `load_topic()` function:
its settings using the `import_topic()` function:
``` lua
```
local flex = require('flex-base')
flex.load_topic('streets')
flex.import_topic('streets')
```
The `load_topic` function takes an optional second configuration
The `import_topic` function takes an optional second configuration
parameter. The available options are explained in the
[themepark section](#using-osm2pgsql-themepark).
Available topics are: `admin`, `street`, `address`, `full`. These topic
correspond to the [import styles](../admin/Import.md#filtering-imported-data)
you can choose during import. To start with the 'extratags' style, use the
`full` topic with the appropriate config parameter:
``` lua
flex.load_topic('full', {with_extratags = true})
```
!!! note
You can also directly import the preset style files, e.g.
`local flex = require('import-street')`. It is not possible to
@@ -68,16 +59,15 @@ When Nominatim processes an OSM object, it looks for four kinds of tags:
The _main tags_ classify what kind of place the OSM object represents. One
OSM object can have more than one main tag. In such case one database entry
is created for each main tag. _Name tags_ represent searchable names of the
place. _Address tags_ are used to compute the address information of the place.
place. _Address tags_ are used to compute the address hierarchy of the place.
Address tags are used for searching and for creating a display name of the place.
_Extra tags_ are any tags that are not directly related to search but
contain interesting additional information. These are just saved in the database
and may be returned with the result [on request](../api/Search.md#output-details).
contain interesting additional information.
!!! danger
Some tags in the extratags category are used by Nominatim to better
classify the place. These tags will always be added, independent of
any settings in the style.
classify the place. You want to make sure these are always present
in custom styles.
Configuring the style means deciding which key and/or key/value is used
in which category.
@@ -126,10 +116,8 @@ value without key, then this is used as default for values that are not listed.
`set_main_tags()` will completely replace the current main tag configuration
with the new configuration. `modify_main_tags()` will merge the new
configuration with the existing one. Merging is done at value level.
For example, when the current setting is `highway = {'always', primary = 'named'}`,
then `set_main_tags{highway = 'delete'}` will result in a rule
`highway = {'delete', primary = 'named'}`.
configuration with the existing one. Otherwise, the two functions do exactly
the same.
!!! example
``` lua
@@ -146,9 +134,9 @@ then `set_main_tags{highway = 'delete'}` will result in a rule
when it has a value of `administrative`. Objects with `highway` tags are
always included with two exceptions: the troll tag `highway=no` is
deleted on the spot. And when the value is `street_lamp` then the object
must also have a name, to be included. Finally, if a `landuse` tag is
present then it will be used independently of the concrete value when
neither boundary nor highway tags were found and the object is named.
must have a name, too. Finally, if a `landuse` tag is present then
it will be used independently of the concrete value when neither boundary
nor highway tags were found and the object is named.
##### Presets
@@ -267,7 +255,11 @@ in turn take precedence over prefix matches.
##### Presets
Accepts all [presets from ignored tags](#presets_1).
| Name | Description |
| :----- | :---------- |
| required | Tags that Nominatim will use for various computations when present in extratags. Always include these. |
In addition, all [presets from ignored tags](#presets_1) are accepted.
### General pre-filtering
@@ -423,56 +415,6 @@ is added for extratags.
already delete the tiger tags with `set_prefilters()` because that
would remove tiger:county before the address tags are processed.
## Filling additional tables
Most of the OSM objects are saved in the main `place` table for further
processing. In addition to that, there are some smaller tables that save
specialised information. The content of these tables can be customized as
well.
### Entrance table
The table `place_entrance` saves information about OSM nodes that represent
an entrance. This data is later mingled with buildings and other areas and
can be returned [on request](../api/Search.md#output-details). The table
saves the type of entrance as well as a set of custom extra tags.
The function `set_entrance_filter()` can be used to customize the table's
content.
When called without any parameter, then filling the entrance table will be
disabled. When called with a preset name, the appropriate preset will be
applied.
To create a custom configuration, call the function
with a table with the following fields:
* __main_tags__ is a list of tags that mark an entrance node. The value of the
first tag found in the list will be used as the entrance type.
* __extra_include__ is an optional list of tags to be added to the extratags
for this entrance. When left out, all tags except for the ones defined
in 'main_tags' will be included. To disable saving of extra tags, set
this to the empty list.
* __extra_exclude__ defines an optional list of tags to drop before including
the remaining tags as extratags. Note that the tags defined in 'main_tags'
will always be excluded, independently of this setting.
To have even more fine-grained control over the output, you can also hand
in a callback for processing entrance information. The callback function
receives a single parameter, the
[osm2pgsql object](https://osm2pgsql.org/doc/manual.html#processing-callbacks).
This object itself must not be modified. The callback should return either
`nil` when the object is not an entrance. Or it returns a table with a
mandatory `entrance` field containing a string with the type of entrance
and an optional `extratags` field with a simple key-value table of extra
information.
##### Presets
| Name | Description |
| :----- | :---------- |
| default | Standard configuration used with `full` and `extratags` styles. |
## Customizing osm2pgsql callbacks
osm2pgsql expects the flex style to implement three callbacks, one process
@@ -614,6 +556,16 @@ the Nominatim topic.
```
Discarding country-level boundaries when running under themepark.
## osm2pgsql gazetteer output
Nominatim still allows you to configure the gazetteer output to remain
backwards compatible with older imports. It will be automatically used
when the style file name ends in `.style`. For documentation of the
old import style, please refer to the documentation of older releases
of Nominatim. Do not use the gazetteer output for new imports. There is no
guarantee that new versions of Nominatim are fully compatible with the
gazetteer output.
## Changing the style of existing databases
There is usually no issue changing the style of a database that is already

View File

@@ -602,44 +602,25 @@ results gathered so far.
Note that under high load you may observe that users receive different results
than usual without seeing an error. This may cause some confusion.
#### NOMINATIM_OUTPUT_NAMES
### Logging Settings
#### NOMINATIM_LOG_DB
| Summary | |
| -------------- | --------------------------------------------------- |
| **Description:** | Specifies order of name tags |
| **Format:** | string: comma-separated list of tag names |
| **Default:** | name:XX,name,brand,official_name:XX,short_name:XX,official_name,short_name,ref |
| **Description:** | Log requests into the database |
| **Format:** | boolean |
| **Default:** | no |
| **After Changes:** | run `nominatim refresh --website` |
Specifies the order in which different name tags are used.
The values in this list determine the preferred order of name variants,
including language-specific names (in OSM: the name tag with and without any language suffix).
Enable logging requests into a database table with this setting. The logs
can be found in the table `new_query_log`.
Comma-separated list, where :XX stands for language suffix
(e.g. name:en) and no :XX stands for general tags (e.g. name).
When using this logging method, it is advisable to set up a job that
regularly clears out old logging information. Nominatim will not do that
on its own.
See also [NOMINATIM_DEFAULT_LANGUAGE](#nominatim_default_language).
!!! note
If NOMINATIM_OUTPUT_NAMES = `name:XX,name,short_name:XX,short_name` the search follows
```
'name', 'short_name'
```
if we have no preferred language order for showing search results.
For languages ['en', 'es'] the search follows
```
'name:en', 'name:es',
'name',
'short_name:en', 'short_name:es',
'short_name'
```
For those familiar with the internal implementation, the `_place_*` expansion is added, but to simplify, it is not included in this example.
### Logging Settings
Can be used as the same time as NOMINATIM_LOG_FILE.
#### NOMINATIM_LOG_FILE
@@ -648,53 +629,23 @@ See also [NOMINATIM_DEFAULT_LANGUAGE](#nominatim_default_language).
| **Description:** | Log requests into a file |
| **Format:** | path |
| **Default:** | _empty_ (logging disabled) |
| **After Changes:** | run `nominatim refresh --website` |
Enable logging of requests into a file with this setting by setting the log
file where to log to. A relative file name is assumed to be relative to
the project directory. The format of the log output can be set
with NOMINATIM_LOG_FORMAT.
the project directory.
#### NOMINATIM_LOG_FORMAT
| Summary | |
| -------------- | --------------------------------------------------- |
| **Description:** | Log requests into a file |
| **Format:** | [Python String Format](https://docs.python.org/3/library/string.html#formatstrings) string |
| **Default:** | `[{start}] {total_time:.4f} {results_total} {endpoint} "{query_string}"` |
The entries in the log file have the following format:
Describes the content of a log line for a single request. The format
must be readable by Python's format function. Nominatim provides a number
of metrics than can be logged. The default set of metrics is the following:
<request time> <execution time in s> <number of results> <type> "<query string>"
/// html | div.simple-table
| name | type | Description |
| --------------- | ------ | ------------|
| start | time | Point in time when the request arrived. |
| end | time | Point in time when the request was done. |
| query_start | time | Point in time when processing started. |
| total_time | float | Total time in seconds to handle the request. |
| wait_time | float | Time in seconds the request waited for a database connection to be available. |
| query_time | float | Total time in seconds to process the request once a connection was available. |
| results_total | int | Number of results found. |
| endpoint | string | API endpoint used. |
| query_string | string | Raw query string received. |
///
Variables of type 'time' contain a UTC timestamp string in ISO format.
Nominatim also exposes additional metrics to help with development. These
are subject to change between versions:
/// html | div.simple-table
| name | type | Description |
| ------------------------- | ------ | ------------|
| search_rounds | int | Total number of searches executed for the request. |
| search_min_penalty | float | Minimal possible penalty for the request. |
| search_first_result_round | int | Number of first search to yield any result. |
| search_min_result_penalty | float | Minimal penalty by a result found. |
| search_best_penalty_round | int | Search round that yielded the best penalty result. |
///
Request time is the time when the request was started. The execution time is
given in seconds and includes the entire time the query was queued and executed
in the frontend.
type contains the name of the endpoint used.
Can be used as the same time as NOMINATIM_LOG_DB.
#### NOMINATIM_DEBUG_SQL

View File

@@ -67,13 +67,7 @@ Here is an example configuration file:
``` yaml
query-preprocessing:
- step: split_japanese_phrases
- step: regex_replace
replacements:
- pattern: https?://[^\s]* # Filter URLs starting with http or https
replace: ''
- step: normalize
- normalize
normalization:
- ":: lower ()"
- "ß > 'ss'" # German szet is unambiguously equal to double ss
@@ -94,8 +88,8 @@ token-analysis:
replacements: ['ä', 'ae']
```
The configuration file contains five sections:
`query-preprocessing`, `normalization`, `transliteration`, `sanitizers` and `token-analysis`.
The configuration file contains four sections:
`normalization`, `transliteration`, `sanitizers` and `token-analysis`.
#### Query preprocessing
@@ -112,19 +106,6 @@ The following is a list of preprocessors that are shipped with Nominatim.
heading_level: 6
docstring_section_style: spacy
##### regex-replace
::: nominatim_api.query_preprocessing.regex_replace
options:
members: False
heading_level: 6
docstring_section_style: spacy
description:
This option runs any given regex pattern on the input and replaces values accordingly
replacements:
- pattern: regex pattern
replace: string to replace with
#### Normalization and Transliteration

View File

@@ -3,7 +3,8 @@
### Import tables
OSM data is initially imported using [osm2pgsql](https://osm2pgsql.org).
Nominatim uses a custom flex style to create the initial import tables.
Nominatim uses its own data output style 'gazetteer', which differs from the
output style created for map rendering.
The import process creates the following tables:
@@ -13,7 +14,7 @@ The `planet_osm_*` tables are the usual backing tables for OSM data. Note
that Nominatim uses them to look up special relations and to find nodes on
ways.
The osm2pgsql import produces a single table `place` as output with the following
The gazetteer style produces a single table `place` as output with the following
columns:
* `osm_type` - kind of OSM object (**N** - node, **W** - way, **R** - relation)

View File

@@ -25,15 +25,15 @@ following packages should get you started:
## Prerequisites for testing and documentation
The Nominatim test suite consists of behavioural tests (using pytest-bdd) and
The Nominatim test suite consists of behavioural tests (using behave) and
unit tests (using pytest). It has the following additional requirements:
* [behave test framework](https://behave.readthedocs.io) >= 1.2.6
* [flake8](https://flake8.pycqa.org/en/stable/) (CI always runs the latest version from pip)
* [mypy](http://mypy-lang.org/) (plus typing information for external libs)
* [Python Typing Extensions](https://github.com/python/typing_extensions) (for Python < 3.9)
* [pytest](https://pytest.org)
* [pytest-asyncio](https://pytest-asyncio.readthedocs.io)
* [pytest-bdd](https://pytest-bdd.readthedocs.io)
For testing the Python search frontend, you need to install extra dependencies
depending on your choice of webserver framework:
@@ -48,6 +48,9 @@ The documentation is built with mkdocs:
* [mkdocs-material](https://squidfunk.github.io/mkdocs-material/)
* [mkdocs-gen-files](https://oprypin.github.io/mkdocs-gen-files/)
Please be aware that tests always run against the globally installed
osm2pgsql, so you need to have this set up. If you want to test against
the vendored version of osm2pgsql, you need to set the PATH accordingly.
### Installing prerequisites on Ubuntu/Debian
@@ -66,10 +69,9 @@ To set up the virtual environment with all necessary packages run:
```sh
virtualenv ~/nominatim-dev-venv
~/nominatim-dev-venv/bin/pip install\
psutil 'psycopg[binary]' PyICU SQLAlchemy \
python-dotenv jinja2 pyYAML \
mkdocs 'mkdocstrings[python]' mkdocs-gen-files \
pytest pytest-asyncio pytest-bdd flake8 \
psutil psycopg[binary] PyICU SQLAlchemy \
python-dotenv jinja2 pyYAML datrie behave \
mkdocs mkdocstrings mkdocs-gen-files pytest pytest-asyncio flake8 \
types-jinja2 types-markupsafe types-psutil types-psycopg2 \
types-pygments types-pyyaml types-requests types-ujson \
types-urllib3 typing-extensions unicorn falcon starlette \
@@ -92,7 +94,7 @@ but executes against the code in the source tree. For example:
```
me@machine:~$ cd Nominatim
me@machine:~Nominatim$ ./nominatim-cli.py --version
Nominatim version 5.1.0-0
Nominatim version 4.4.99-1
```
Make sure you have activated the virtual environment holding all

View File

@@ -60,19 +60,13 @@ The order of phrases matters to Nominatim when doing further processing.
Thus, while you may split or join phrases, you should not reorder them
unless you really know what you are doing.
Phrase types can further help narrowing down how the tokens in the phrase
are interpreted. The following phrase types are known:
Phrase types (`nominatim_api.search.PhraseType`) can further help narrowing
down how the tokens in the phrase are interpreted. The following phrase types
are known:
| Name | Description |
|----------------|-------------|
| PHRASE_ANY | No specific designation (i.e. source is free-form query) |
| PHRASE_AMENITY | Contains name or type of a POI |
| PHRASE_STREET | Contains a street name optionally with a housenumber |
| PHRASE_CITY | Contains the postal city |
| PHRASE_COUNTY | Contains the equivalent of a county |
| PHRASE_STATE | Contains a state or province |
| PHRASE_POSTCODE| Contains a postal code |
| PHRASE_COUNTRY | Contains the country name or code |
::: nominatim_api.search.PhraseType
options:
heading_level: 6
## Custom sanitizer modules

View File

@@ -43,53 +43,53 @@ The name of the pytest binary depends on your installation.
## BDD Functional Tests (`test/bdd`)
Functional tests are written as BDD instructions. For more information on
the philosophy of BDD testing, read the Wikipedia article on
[Behaviour-driven development](https://en.wikipedia.org/wiki/Behavior-driven_development).
the philosophy of BDD testing, see the
[Behave manual](http://pythonhosted.org/behave/philosophy.html).
The following explanation assume that the reader is familiar with the BDD
notations of features, scenarios and steps.
All possible steps can be found in the `steps` directory and should ideally
be documented.
### General Usage
To run the functional tests, do
pytest test/bdd
cd test/bdd
behave
The BDD tests create databases for the tests. You can set name of the databases
through configuration variables in your `pytest.ini`:
The tests can be configured with a set of environment variables (`behave -D key=val`):
* `nominatim_test_db` defines the name of the temporary database created for
a single test (default: `test_nominatim`)
* `nominatim_api_test_db` defines the name of the database containing
the API test data, see also below (default: `test_api_nominatim`)
* `nominatim_template_db` defines the name of the template database used
for creating the temporary test databases. It contains some static setup
which usually doesn't change between imports of OSM data
(default: `test_template_nominatim`)
To change other connection parameters for the PostgreSQL database, use
the [libpq enivronment variables](https://www.postgresql.org/docs/current/libpq-envars.html).
Never set a password through these variables. Use a
[password file](https://www.postgresql.org/docs/current/libpq-pgpass.html) instead.
The API test database and the template database are only created once and then
left untouched. This is usually what you want because it speeds up subsequent
runs of BDD tests. If you do change code that has an influence on the content
of these databases, you can run pytest with the `--nominatim-purge` parameter
and the databases will be dropped and recreated from scratch.
When running the BDD tests with make (using `make tests` or `make bdd`), then
the databases will always be purged.
The temporary test database is usually dropped directly after the test, so
it does not take up unnecessary space. If you want to keep the database around,
for example while debugging a specific BDD test, use the parameter
`--nominatim-keep-db`.
* `TEMPLATE_DB` - name of template database used as a skeleton for
the test databases (db tests)
* `TEST_DB` - name of test database (db tests)
* `API_TEST_DB` - name of the database containing the API test data (api tests)
* `API_TEST_FILE` - OSM file to be imported into the API test database (api tests)
* `API_ENGINE` - webframe to use for running search queries, same values as
`nominatim serve --engine` parameter
* `DB_HOST` - (optional) hostname of database host
* `DB_PORT` - (optional) port of database on host
* `DB_USER` - (optional) username of database login
* `DB_PASS` - (optional) password for database login
* `REMOVE_TEMPLATE` - if true, the template and API database will not be reused
during the next run. Reusing the base templates speeds
up tests considerably but might lead to outdated errors
for some changes in the database layout.
* `KEEP_TEST_DB` - if true, the test database will not be dropped after a test
is finished. Should only be used if one single scenario is
run, otherwise the result is undefined.
Logging can be defined through command line parameters of behave itself. Check
out `behave --help` for details. Also have a look at the 'work-in-progress'
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 to import several datasets into a test database. This is normally
done automatically during setup of the test. The API test database is then
kept around and reused in subsequent runs of behave. Use `--nominatim-purge`
kept around and reused in subsequent runs of behave. Use `behave -DREMOVE_TEMPLATE`
to force a reimport of the database.
The official test dataset is saved in the file `test/testdb/apidb-test-data.pbf`
@@ -109,12 +109,12 @@ test the correctness of osm2pgsql. Each test will write some data into the `plac
table (and optionally the `planet_osm_*` tables if required) and then run
Nominatim's processing functions on that.
These tests use the template database and create temporary test databases for
each test.
These tests need to create their own test databases. By default they will be
called `test_template_nominatim` and `test_nominatim`. Names can be changed with
the environment variables `TEMPLATE_DB` and `TEST_DB`. The user running the tests
needs superuser rights for postgres.
### Import Tests (`test/bdd/osm2pgsql`)
These tests check that data is imported correctly into the place table.
These tests also use the template database and create temporary test databases
for each test.
These tests check that data is imported correctly into the place table. They
use the same template database as the DB Creation tests, so the same remarks apply.

View File

@@ -9,7 +9,7 @@ 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
flex output style defined in the directory `/lib-lua`. 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`

View File

@@ -39,9 +39,3 @@ th {
filter: grayscale(100%);
font-size: 80%;
}
.simple-table table:not([class]) th,
.simple-table table:not([class]) td {
padding: 2px 4px;
background: white;
}

View File

@@ -268,17 +268,13 @@ name out of it:
'Brugges'
```
The `address_row` field has a helper function to compute the display name for each Address Line
component based on its `local_name` field. This is then utilized by the overall `result` object,
which has a helper function to apply the function to all its address_row members and saves
the result in the `locale_name` field.
However, in order to set this `local_name` field in a preferred language, you must use the `Locale`
object which contains the function `localize_results`, which explicitly sets each `local_name field`.
The `address_row` field has a helper function to apply the function to all
its members and save the result in the `local_name` field. It also returns
all the localized names as a convenient simple list. This list can be used
to create a human-readable output:
``` python
>>> Locales().localize_results(results)
>>> address_parts = results[0].address_rows
>>> address_parts = results[0].address_rows.localize(locale)
>>> print(', '.join(address_parts))
Bruges, Flandre-Occidentale, Flandre, Belgique
```

View File

@@ -49,11 +49,7 @@ its address.
## Localization
Results are always returned with the full list of available names. However, the
default `locale_name` must be explicitly set using the `localize` function within
`Locales`. This parses through the full list of available names to find the one
most preferred by the user. Once this is set, the user can simply use the
`display_name` field within a `Result` object to retrive the localized name.
Results are always returned with the full list of available names.
### Locale

View File

@@ -29,9 +29,7 @@ local NAME_FILTER = nil
local ADDRESS_TAGS = {}
local ADDRESS_FILTER = nil
local EXTRATAGS_FILTER
local REQUIRED_EXTRATAGS_FILTER
local POSTCODE_FALLBACK = true
local ENTRANCE_FUNCTION = nil
-- This file can also be directly require'd instead of running it under
-- the themepark framework. In that case the first parameter is usually
@@ -42,51 +40,37 @@ if type(themepark) ~= 'table' then
themepark = nil
end
-- The place tables carry the raw OSM information.
local table_definitions = {
place = {
ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
columns = {
{ column = 'class', type = 'text', not_null = true },
{ column = 'type', type = 'text', not_null = true },
{ column = 'admin_level', type = 'smallint' },
{ column = 'name', type = 'hstore' },
{ column = 'address', type = 'hstore' },
{ column = 'extratags', type = 'hstore' },
{ column = 'geometry', type = 'geometry', projection = 'WGS84', not_null = true },
},
indexes = {}
-- The single place table.
local place_table_definition = {
name = "place",
ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
columns = {
{ column = 'class', type = 'text', not_null = true },
{ column = 'type', type = 'text', not_null = true },
{ column = 'admin_level', type = 'smallint' },
{ column = 'name', type = 'hstore' },
{ column = 'address', type = 'hstore' },
{ column = 'extratags', type = 'hstore' },
{ column = 'geometry', type = 'geometry', projection = 'WGS84', not_null = true },
},
place_entrance = {
ids = { type = 'node', id_column = 'osm_id' },
columns = {
{ column = 'type', type = 'text', not_null = true },
{ column = 'extratags', type = 'hstore' },
{ column = 'geometry', type = 'geometry', projection = 'WGS84', not_null = true }
},
indexes = {}
}
data_tablespace = os.getenv("NOMINATIM_TABLESPACE_PLACE_DATA"),
index_tablespace = os.getenv("NOMINATIM_TABLESPACE_PLACE_INDEX"),
indexes = {}
}
local insert_row = {}
local insert_row
local script_path = debug.getinfo(1, "S").source:match("@?(.*/)")
local PRESETS = loadfile(script_path .. 'presets.lua')()
for table_name, table_definition in pairs(table_definitions) do
table_definition.name = table_name
table_definition.data_tablespace = os.getenv("NOMINATIM_TABLESPACE_PLACE_DATA")
table_definition.index_tablespace = os.getenv("NOMINATIM_TABLESPACE_PLACE_INDEX")
if themepark then
themepark:add_table(table_definition)
insert_row[table_name] = function(columns)
themepark:insert(table_name, columns, {}, {})
end
else
local place_table = osm2pgsql.define_table(table_definition)
insert_row[table_name] = function(columns)
place_table:insert(columns)
end
if themepark then
themepark:add_table(place_table_definition)
insert_row = function(columns)
themepark:insert('place', columns, {}, {})
end
else
local place_table = osm2pgsql.define_table(place_table_definition)
insert_row = function(columns)
place_table:insert(columns)
end
end
@@ -166,6 +150,24 @@ local function address_fallback(place)
return place:clone{names=names}
end
--------- Built-in extratags transformation functions ---------------
local function default_extratags_filter(p, k)
-- Default handling is to copy over place tag for boundaries.
-- Nominatim needs this.
if k ~= 'boundary' or p.intags.place == nil then
return p.extratags
end
local extra = { place = p.intags.place }
for kin, vin in pairs(p.extratags) do
extra[kin] = vin
end
return extra
end
EXTRATAGS_FILTER = default_extratags_filter
----------------- other helper functions -----------------------------
local function lookup_prefilter_classification(k, v)
@@ -427,25 +429,18 @@ function Place:write_row(k, v)
return 0
end
local extra = EXTRATAGS_FILTER(self, k, v) or {}
local extratags = EXTRATAGS_FILTER(self, k, v)
if not (extratags and next(extratags)) then
extratags = nil
end
for tk, tv in pairs(self.object.tags) do
if REQUIRED_EXTRATAGS_FILTER(tk, tv) and extra[tk] == nil then
extra[tk] = tv
end
end
if extra and next(extra) == nil then
extra = nil
end
insert_row.place{
insert_row{
class = k,
type = v,
admin_level = self.admin_level,
name = next(self.names) and self.names,
address = next(self.address) and self.address,
extratags = extra,
extratags = extratags,
geometry = self.geometry
}
@@ -598,16 +593,6 @@ end
-- Process functions for all data types
function module.process_node(object)
if ENTRANCE_FUNCTION ~= nil then
local entrance_info = ENTRANCE_FUNCTION(object)
if entrance_info ~= nil then
insert_row.place_entrance{
type = entrance_info.entrance,
extratags = entrance_info.extratags,
geometry = object:as_point()
}
end
end
local function geom_func(o)
return o:as_point()
@@ -702,15 +687,6 @@ function module.process_tags(o)
end
end
--------- Extratags post-processing functions ---------------
local function default_extratags_filter(p, k)
return p.extratags
end
EXTRATAGS_FILTER = default_extratags_filter
REQUIRED_EXTRATAGS_FILTER = module.tag_match(PRESETS.EXTRATAGS)
--------- Convenience functions for simple style configuration -----------------
function module.set_prefilters(data)
@@ -741,7 +717,7 @@ end
function module.add_for_extratags(data)
if type(data) == 'string' then
local preset = data
data = PRESETS.IGNORE_KEYS[data]
data = PRESETS.EXTRATAGS[data] or PRESETS.IGNORE_KEYS[data]
if data == nil then
error('Unknown preset for extratags: ' .. preset)
end
@@ -941,99 +917,6 @@ function module.set_relation_types(data)
end
end
function module.set_entrance_filter(data)
if data == nil or type(data) == 'function' then
ENTRANCE_FUNCTION = data
return nil
end
if type(data) == 'string' then
local preset = data
data = PRESETS.ENTRANCE_TABLE[data]
if data == nil then
error('Unknown preset for entrance table: ' .. preset)
end
end
ENTRANCE_FUNCTION = nil
if data.main_tags ~= nil and next(data.main_tags) ~= nil then
if data.extra_include ~= nil and next(data.extra_include) == nil then
-- shortcut: no extra tags requested
ENTRANCE_FUNCTION = function(o)
for _, v in ipairs(data.main_tags) do
if o.tags[v] ~= nil then
return {entrance = o.tags[v]}
end
end
return nil
end
else
if data.extra_include ~= nil then
local tags = {}
for _, v in pairs(data.extra_include) do
tags[v] = true
end
if data.extra_exclude ~= nil then
for _, v in pairs(data.extra_exclude) do
tags[v] = nil
end
end
for _, v in pairs(data.main_tags) do
tags[v] = nil
end
ENTRANCE_FUNCTION = function(o)
for _, v in ipairs(data.main_tags) do
if o.tags[v] ~= nil then
local entrance = o.tags[v]
local extra = {}
for k, v in pairs(tags) do
extra[k] = o.tags[k]
end
if next(extra) == nil then
extra = nil
end
return {entrance = entrance, extratags = extra}
end
end
return nil
end
else
local notags = {}
if data.extra_exclude ~= nil then
for _, v in pairs(data.extra_exclude) do
notags[v] = 1
end
end
for _, v in pairs(data.main_tags) do
notags[v] = 1
end
ENTRANCE_FUNCTION = function(o)
for _, v in ipairs(data.main_tags) do
if o.tags[v] ~= nil then
local entrance = o.tags[v]
local extra = {}
for k, v in pairs(o.tags) do
if notags[k] ~= 1 then
extra[k] = v
end
end
if next(extra) == nil then
extra = nil
end
return {entrance = entrance, extratags = extra}
end
end
return nil
end
end
end
end
end
function module.get_taginfo()
return {main = MAIN_KEYS, name = NAMES, address = ADDRESS_TAGS}

View File

@@ -187,7 +187,7 @@ module.MAIN_TAGS_POIS = function (group)
passing_place = group,
street_lamp = 'named',
traffic_signals = 'named'},
historic = {'fallback',
historic = {'always',
yes = group,
no = group},
information = {include_when_tag_present('tourism', 'information'),
@@ -196,12 +196,9 @@ module.MAIN_TAGS_POIS = function (group)
trail_blaze = 'never'},
junction = {'fallback',
no = group},
landuse = {cemetery = 'always'},
leisure = {'always',
nature_reserve = 'fallback',
swimming_pool = 'named',
garden = 'named',
common = 'named',
no = group},
lock = {yes = lock_transform},
man_made = {pier = 'always',
@@ -232,7 +229,6 @@ module.MAIN_TAGS_POIS = function (group)
shop = {'always',
no = group},
tourism = {'always',
attraction = 'fallback',
no = group,
yes = group,
information = exclude_when_key_present('information')},
@@ -334,7 +330,7 @@ module.NAME_TAGS.core = {main = {'name', 'name:*',
}
module.NAME_TAGS.address = {house = {'addr:housename'}}
module.NAME_TAGS.poi = group_merge({main = {'brand'},
extra = {'iata', 'icao', 'faa'}},
extra = {'iata', 'icao'}},
module.NAME_TAGS.core)
-- Address tagging
@@ -364,7 +360,7 @@ module.IGNORE_KEYS.metatags = {'note', 'note:*', 'source', 'source:*', '*source'
'tiger:cfcc', 'tiger:reviewed', 'nysgissam:*',
'NHD:*', 'nhd:*', 'gnis:*', 'geobase:*', 'yh:*',
'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
'lacounty:*', 'ref:linz:*', 'survey:*',
'lacounty:*', 'ref:linz:*',
'ref:bygningsnr', 'ref:ruian:*', 'building:ruian:type',
'type',
'is_in:postcode'}
@@ -375,15 +371,10 @@ module.IGNORE_KEYS.address = {'addr:street:*', 'addr:city:*', 'addr:district:*',
'addr:province:*', 'addr:subdistrict:*', 'addr:place:*',
'addr:TW:dataset'}
-- INTERNAL: Required extra tags
-- Extra tags (prefiltered away)
module.EXTRATAGS = {keys = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}}
module.EXTRATAGS = {}
-- Defaults for the entrance table
module.ENTRANCE_TABLE = {}
module.ENTRANCE_TABLE.default = {main_tags = {'entrance', 'routing:entrance'},
extra_exclude = module.IGNORE_KEYS.metatags}
module.EXTRATAGS.required = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}
return module

View File

@@ -11,6 +11,7 @@ flex.set_address_tags('core')
flex.modify_address_tags('houses')
flex.ignore_keys('metatags')
flex.add_for_extratags('required')
if cfg.with_extratags then
flex.set_unused_handling{delete_keys = {'tiger:*'}}

View File

@@ -8,6 +8,7 @@ flex.set_address_tags('core')
flex.set_postcode_fallback(false)
flex.ignore_keys('metatags')
flex.add_for_extratags('required')
if cfg.with_extratags then
flex.set_unused_handling{delete_keys = {'tiger:*'}}

View File

@@ -20,6 +20,7 @@ flex.set_address_tags('core')
flex.modify_address_tags('houses')
flex.ignore_keys('metatags')
flex.add_for_extratags('required')
if cfg.with_extratags then
flex.set_unused_handling{delete_keys = {'tiger:*'}}
@@ -29,5 +30,3 @@ else
flex.ignore_keys('name')
flex.ignore_keys('address')
end
flex.set_entrance_filter('default')

View File

@@ -10,6 +10,7 @@ flex.set_address_tags('core')
flex.set_postcode_fallback(false)
flex.ignore_keys('metatags')
flex.add_for_extratags('required')
if cfg.with_extratags then
flex.set_unused_handling{delete_keys = {'tiger:*'}}

View File

@@ -8,6 +8,7 @@
{% include('functions/utils.sql') %}
{% include('functions/ranking.sql') %}
{% include('functions/importance.sql') %}
{% include('functions/address_lookup.sql') %}
{% include('functions/interpolation.sql') %}
{% if 'place' in db.tables %}

View File

@@ -0,0 +1,334 @@
-- SPDX-License-Identifier: GPL-2.0-only
--
-- This file is part of Nominatim. (https://nominatim.org)
--
-- Copyright (C) 2022 by the Nominatim developer community.
-- For a full list of authors see the git log.
-- Functions for returning address information for a place.
DROP TYPE IF EXISTS addressline CASCADE;
CREATE TYPE addressline as (
place_id BIGINT,
osm_type CHAR(1),
osm_id BIGINT,
name HSTORE,
class TEXT,
type TEXT,
place_type TEXT,
admin_level INTEGER,
fromarea BOOLEAN,
isaddress BOOLEAN,
rank_address INTEGER,
distance FLOAT
);
CREATE OR REPLACE FUNCTION get_name_by_language(name hstore, languagepref TEXT[])
RETURNS TEXT
AS $$
DECLARE
result TEXT;
BEGIN
IF name is null THEN
RETURN null;
END IF;
FOR j IN 1..array_upper(languagepref,1) LOOP
IF name ? languagepref[j] THEN
result := trim(name->languagepref[j]);
IF result != '' THEN
return result;
END IF;
END IF;
END LOOP;
-- as a fallback - take the last element since it is the default name
RETURN trim((avals(name))[array_length(avals(name), 1)]);
END;
$$
LANGUAGE plpgsql IMMUTABLE;
--housenumber only needed for tiger data
CREATE OR REPLACE FUNCTION get_address_by_language(for_place_id BIGINT,
housenumber INTEGER,
languagepref TEXT[])
RETURNS TEXT
AS $$
DECLARE
result TEXT[];
currresult TEXT;
prevresult TEXT;
location RECORD;
BEGIN
result := '{}';
prevresult := '';
FOR location IN
SELECT name,
CASE WHEN place_id = for_place_id THEN 99 ELSE rank_address END as rank_address
FROM get_addressdata(for_place_id, housenumber)
WHERE isaddress order by rank_address desc
LOOP
currresult := trim(get_name_by_language(location.name, languagepref));
IF currresult != prevresult AND currresult IS NOT NULL
AND result[(100 - location.rank_address)] IS NULL
THEN
result[(100 - location.rank_address)] := currresult;
prevresult := currresult;
END IF;
END LOOP;
RETURN array_to_string(result,', ');
END;
$$
LANGUAGE plpgsql STABLE;
DROP TYPE IF EXISTS addressdata_place;
CREATE TYPE addressdata_place AS (
place_id BIGINT,
country_code VARCHAR(2),
housenumber TEXT,
postcode TEXT,
class TEXT,
type TEXT,
name HSTORE,
address HSTORE,
centroid GEOMETRY
);
-- Compute the list of address parts for the given place.
--
-- If in_housenumber is greator or equal 0, look for an interpolation.
CREATE OR REPLACE FUNCTION get_addressdata(in_place_id BIGINT, in_housenumber INTEGER)
RETURNS setof addressline
AS $$
DECLARE
place addressdata_place;
location RECORD;
country RECORD;
current_rank_address INTEGER;
location_isaddress BOOLEAN;
BEGIN
-- The place in question might not have a direct entry in place_addressline.
-- Look for the parent of such places then and save it in place.
-- first query osmline (interpolation lines)
IF in_housenumber >= 0 THEN
SELECT parent_place_id as place_id, country_code,
in_housenumber as housenumber, postcode,
'place' as class, 'house' as type,
null as name, null as address,
ST_Centroid(linegeo) as centroid
INTO place
FROM location_property_osmline
WHERE place_id = in_place_id
AND in_housenumber between startnumber and endnumber;
END IF;
--then query tiger data
{% if config.get_bool('USE_US_TIGER_DATA') %}
IF place IS NULL AND in_housenumber >= 0 THEN
SELECT parent_place_id as place_id, 'us' as country_code,
in_housenumber as housenumber, postcode,
'place' as class, 'house' as type,
null as name, null as address,
ST_Centroid(linegeo) as centroid
INTO place
FROM location_property_tiger
WHERE place_id = in_place_id
AND in_housenumber between startnumber and endnumber;
END IF;
{% endif %}
-- postcode table
IF place IS NULL THEN
SELECT parent_place_id as place_id, country_code,
null::text as housenumber, postcode,
'place' as class, 'postcode' as type,
null as name, null as address,
null as centroid
INTO place
FROM location_postcode
WHERE place_id = in_place_id;
END IF;
-- POI objects in the placex table
IF place IS NULL THEN
SELECT parent_place_id as place_id, country_code,
coalesce(address->'housenumber',
address->'streetnumber',
address->'conscriptionnumber')::text as housenumber,
postcode,
class, type,
name, address,
centroid
INTO place
FROM placex
WHERE place_id = in_place_id and rank_search > 27;
END IF;
-- If place is still NULL at this point then the object has its own
-- entry in place_address line. However, still check if there is not linked
-- place we should be using instead.
IF place IS NULL THEN
select coalesce(linked_place_id, place_id) as place_id, country_code,
null::text as housenumber, postcode,
class, type,
null as name, address,
null as centroid
INTO place
FROM placex where place_id = in_place_id;
END IF;
--RAISE WARNING '% % % %',searchcountrycode, searchhousenumber, searchpostcode;
-- --- Return the record for the base entry.
current_rank_address := 1000;
FOR location IN
SELECT placex.place_id, osm_type, osm_id, name,
coalesce(extratags->'linked_place', extratags->'place') as place_type,
class, type, admin_level,
CASE WHEN rank_address = 0 THEN 100
WHEN rank_address = 11 THEN 5
ELSE rank_address END as rank_address,
country_code
FROM placex
WHERE place_id = place.place_id
LOOP
--RAISE WARNING '%',location;
-- mix in default names for countries
IF location.rank_address = 4 and place.country_code is not NULL THEN
FOR country IN
SELECT coalesce(name, ''::hstore) as name FROM country_name
WHERE country_code = place.country_code LIMIT 1
LOOP
place.name := country.name || place.name;
END LOOP;
END IF;
IF location.rank_address < 4 THEN
-- no country locations for ranks higher than country
place.country_code := NULL::varchar(2);
ELSEIF place.country_code IS NULL AND location.country_code IS NOT NULL THEN
place.country_code := location.country_code;
END IF;
RETURN NEXT ROW(location.place_id, location.osm_type, location.osm_id,
location.name, location.class, location.type,
location.place_type,
location.admin_level, true,
location.type not in ('postcode', 'postal_code'),
location.rank_address, 0)::addressline;
current_rank_address := location.rank_address;
END LOOP;
-- --- Return records for address parts.
FOR location IN
SELECT placex.place_id, osm_type, osm_id, name, class, type,
coalesce(extratags->'linked_place', extratags->'place') as place_type,
admin_level, fromarea, isaddress,
CASE WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
distance, country_code, postcode
FROM place_addressline join placex on (address_place_id = placex.place_id)
WHERE place_addressline.place_id IN (place.place_id, in_place_id)
AND linked_place_id is null
AND (placex.country_code IS NULL OR place.country_code IS NULL
OR placex.country_code = place.country_code)
ORDER BY rank_address desc,
(place_addressline.place_id = in_place_id) desc,
(CASE WHEN coalesce((avals(name) && avals(place.address)), False) THEN 2
WHEN isaddress THEN 0
WHEN fromarea
and place.centroid is not null
and ST_Contains(geometry, place.centroid) THEN 1
ELSE -1 END) desc,
fromarea desc, distance asc, rank_search desc
LOOP
-- RAISE WARNING '%',location;
location_isaddress := location.rank_address != current_rank_address;
IF place.country_code IS NULL AND location.country_code IS NOT NULL THEN
place.country_code := location.country_code;
END IF;
IF location.type in ('postcode', 'postal_code')
AND place.postcode is not null
THEN
-- If the place had a postcode assigned, take this one only
-- into consideration when it is an area and the place does not have
-- a postcode itself.
IF location.fromarea AND location_isaddress
AND (place.address is null or not place.address ? 'postcode')
THEN
place.postcode := null; -- remove the less exact postcode
ELSE
location_isaddress := false;
END IF;
END IF;
RETURN NEXT ROW(location.place_id, location.osm_type, location.osm_id,
location.name, location.class, location.type,
location.place_type,
location.admin_level, location.fromarea,
location_isaddress,
location.rank_address,
location.distance)::addressline;
current_rank_address := location.rank_address;
END LOOP;
-- If no country was included yet, add the name information from country_name.
IF current_rank_address > 4 THEN
FOR location IN
SELECT name || coalesce(derived_name, ''::hstore) as name FROM country_name
WHERE country_code = place.country_code LIMIT 1
LOOP
--RAISE WARNING '% % %',current_rank_address,searchcountrycode,countryname;
RETURN NEXT ROW(null, null, null, location.name, 'place', 'country', NULL,
null, true, true, 4, 0)::addressline;
END LOOP;
END IF;
-- Finally add some artificial rows.
IF place.country_code IS NOT NULL THEN
location := ROW(null, null, null, hstore('ref', place.country_code),
'place', 'country_code', null, null, true, false, 4, 0)::addressline;
RETURN NEXT location;
END IF;
IF place.name IS NOT NULL THEN
location := ROW(in_place_id, null, null, place.name, place.class,
place.type, null, null, true, true, 29, 0)::addressline;
RETURN NEXT location;
END IF;
IF place.housenumber IS NOT NULL THEN
location := ROW(null, null, null, hstore('ref', place.housenumber),
'place', 'house_number', null, null, true, true, 28, 0)::addressline;
RETURN NEXT location;
END IF;
IF place.address is not null and place.address ? '_unlisted_place' THEN
RETURN NEXT ROW(null, null, null, hstore('name', place.address->'_unlisted_place'),
'place', 'locality', null, null, true, true, 25, 0)::addressline;
END IF;
IF place.postcode is not null THEN
location := ROW(null, null, null, hstore('ref', place.postcode), 'place',
'postcode', null, null, false, true, 5, 0)::addressline;
RETURN NEXT location;
ELSEIF place.address is not null and place.address ? 'postcode'
and not place.address->'postcode' SIMILAR TO '%(,|;)%' THEN
location := ROW(null, null, null, hstore('ref', place.address->'postcode'), 'place',
'postcode', null, null, false, true, 5, 0)::addressline;
RETURN NEXT location;
END IF;
RETURN;
END;
$$
LANGUAGE plpgsql STABLE;

View File

@@ -65,7 +65,7 @@ BEGIN
RETURN NULL;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
{% else %}
@@ -78,7 +78,7 @@ SELECT convert_from(CAST(E'\\x' || array_to_string(ARRAY(
FROM regexp_matches($1, '%[0-9a-f][0-9a-f]|.', 'gi') AS r(m)
), '') AS bytea), 'UTF8');
$$
LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION catch_decode_url_part(p varchar)
@@ -91,7 +91,7 @@ EXCEPTION
WHEN others THEN return null;
END;
$$
LANGUAGE plpgsql IMMUTABLE STRICT PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION get_wikipedia_match(extratags HSTORE, country_code varchar(2))
@@ -139,7 +139,7 @@ BEGIN
RETURN NULL;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
{% endif %}
@@ -203,5 +203,5 @@ BEGIN
RETURN result;
END;
$$
LANGUAGE plpgsql PARALLEL SAFE;
LANGUAGE plpgsql;

View File

@@ -34,7 +34,7 @@ BEGIN
RETURN in_address;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
@@ -70,7 +70,7 @@ BEGIN
RETURN parent_place_id;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION reinsert_interpolation(way_id BIGINT, addr HSTORE,
@@ -309,7 +309,7 @@ BEGIN
IF NEW.startnumber IS NULL THEN
NEW.startnumber := startnumber;
NEW.endnumber := endnumber;
NEW.linegeo := ST_ReducePrecision(sectiongeo, 0.0000001);
NEW.linegeo := sectiongeo;
NEW.postcode := postcode;
ELSE
INSERT INTO location_property_osmline
@@ -317,8 +317,7 @@ BEGIN
startnumber, endnumber, step,
address, postcode, country_code,
geometry_sector, indexed_status)
VALUES (ST_ReducePrecision(sectiongeo, 0.0000001),
NEW.partition, NEW.osm_id, NEW.parent_place_id,
VALUES (sectiongeo, NEW.partition, NEW.osm_id, NEW.parent_place_id,
startnumber, endnumber, NEW.step,
NEW.address, postcode,
NEW.country_code, NEW.geometry_sector, 0);

View File

@@ -58,7 +58,7 @@ BEGIN
RAISE EXCEPTION 'Unknown partition %', in_partition;
END
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION get_address_place(in_partition SMALLINT, feature GEOMETRY,
@@ -87,7 +87,7 @@ BEGIN
RAISE EXCEPTION 'Unknown partition %', in_partition;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
create or replace function deleteLocationArea(in_partition INTEGER, in_place_id BIGINT, in_rank_search INTEGER) RETURNS BOOLEAN AS $$
@@ -172,7 +172,7 @@ BEGIN
RAISE EXCEPTION 'Unknown partition %', in_partition;
END
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION getNearestNamedPlacePlaceId(in_partition INTEGER,
point GEOMETRY,
@@ -202,7 +202,7 @@ BEGIN
RAISE EXCEPTION 'Unknown partition %', in_partition;
END
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
create or replace function insertSearchName(
in_partition INTEGER, in_place_id BIGINT, in_name_vector INTEGER[],
@@ -310,7 +310,7 @@ BEGIN
RAISE EXCEPTION 'Unknown partition %', in_partition;
END
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION getNearestParallelRoadFeature(in_partition INTEGER,
line GEOMETRY)
@@ -354,4 +354,4 @@ BEGIN
RAISE EXCEPTION 'Unknown partition %', in_partition;
END
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;

View File

@@ -338,11 +338,6 @@ BEGIN
END IF;
END IF;
-- When an existing way is updated, recalculate entrances
IF existingplacex.osm_type = 'W' and (existingplacex.rank_search > 27 or existingplacex.class IN ('landuse', 'leisure')) THEN
PERFORM place_update_entrances(existingplacex.place_id, existingplacex.osm_id);
END IF;
-- Abort the insertion (we modified the existing place instead)
RETURN NULL;
END;

View File

@@ -2,7 +2,7 @@
--
-- This file is part of Nominatim. (https://nominatim.org)
--
-- Copyright (C) 2025 by the Nominatim developer community.
-- Copyright (C) 2024 by the Nominatim developer community.
-- For a full list of authors see the git log.
-- Trigger functions for the placex table.
@@ -109,7 +109,7 @@ BEGIN
RETURN result;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION find_associated_street(poi_osm_type CHAR(1),
@@ -200,7 +200,7 @@ BEGIN
RETURN result;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
-- Find the parent road of a POI.
@@ -286,7 +286,7 @@ BEGIN
RETURN parent_place_id;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
-- Try to find a linked place for the given object.
CREATE OR REPLACE FUNCTION find_linked_place(bnd placex)
@@ -404,7 +404,7 @@ BEGIN
RETURN NULL;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION create_poi_search_terms(obj_place_id BIGINT,
@@ -530,7 +530,6 @@ CREATE OR REPLACE FUNCTION insert_addresslines(obj_place_id BIGINT,
AS $$
DECLARE
address_havelevel BOOLEAN[];
place_min_distance FLOAT[];
location_isaddress BOOLEAN;
current_boundary GEOMETRY := NULL;
@@ -546,7 +545,6 @@ BEGIN
nameaddress_vector := '{}'::int[];
address_havelevel := array_fill(false, ARRAY[maxrank]);
place_min_distance := array_fill(1.0, ARRAY[maxrank]);
FOR location IN
SELECT apl.*, key
@@ -577,10 +575,6 @@ BEGIN
END IF;
END IF;
IF location.isguess and location.distance < place_min_distance[location.rank_address] THEN
place_min_distance[location.rank_address] := location.distance;
END IF;
INSERT INTO place_addressline (place_id, address_place_id, fromarea,
isaddress, distance, cached_rank_address)
VALUES (obj_place_id, location.place_id, not location.isguess,
@@ -608,16 +602,6 @@ BEGIN
-- If this is the first item in the rank, then assume it is the address.
location_isaddress := not address_havelevel[location.rank_address];
-- Ignore guessed places when they are too far away compared to similar closer ones.
IF location.isguess THEN
CONTINUE WHEN not location_isaddress
AND location.distance > 2 * place_min_distance[location.rank_address];
IF location.distance < place_min_distance[location.rank_address] THEN
place_min_distance[location.rank_address] := location.distance;
END IF;
END IF;
-- Further sanity checks to ensure that the address forms a sane hierarchy.
IF location_isaddress THEN
IF location.isguess and current_node_area is not NULL THEN
@@ -654,10 +638,8 @@ BEGIN
-- Add it to the list of search terms
{% if not db.reverse_only %}
IF location.rank_address != 11 AND location.rank_address != 5 THEN
nameaddress_vector := array_merge(nameaddress_vector,
location.keywords::integer[]);
END IF;
nameaddress_vector := array_merge(nameaddress_vector,
location.keywords::integer[]);
{% endif %}
INSERT INTO place_addressline (place_id, address_place_id, fromarea,
@@ -748,7 +730,7 @@ BEGIN
IF NEW.rank_address between 2 and 27 THEN
IF (ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(NEW.geometry)) THEN
-- Performance: We just can't handle re-indexing for country level changes
IF (NEW.rank_address < 26 and st_area(NEW.geometry) <= 2)
IF (NEW.rank_address < 26 and st_area(NEW.geometry) < 1)
OR (NEW.rank_address >= 26 and st_area(NEW.geometry) < 0.01)
THEN
-- mark items within the geometry for re-indexing
@@ -796,7 +778,7 @@ BEGIN
SELECT count(*)>0 FROM pg_tables WHERE tablename = classtable and schemaname = current_schema() INTO result;
IF result THEN
EXECUTE 'INSERT INTO ' || classtable::regclass || ' (place_id, centroid) VALUES ($1,$2)'
USING NEW.place_id, NEW.centroid;
USING NEW.place_id, ST_Centroid(NEW.geometry);
END IF;
{% endif %} -- not disable_diff_updates
@@ -890,11 +872,6 @@ BEGIN
-- Compute a preliminary centroid.
NEW.centroid := get_center_point(NEW.geometry);
-- Record the entrance node locations
IF NEW.osm_type = 'W' and (NEW.rank_search > 27 or NEW.class IN ('landuse', 'leisure')) THEN
PERFORM place_update_entrances(NEW.place_id, NEW.osm_id);
END IF;
-- recalculate country and partition
IF NEW.rank_search = 4 AND NEW.address is not NULL AND NEW.address ? 'country' THEN
-- for countries, believe the mapped country code,
@@ -983,8 +960,9 @@ BEGIN
WHERE class = 'place' and rank_address between 1 and 23
and prank.address_rank >= NEW.rank_address
and ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') -- select right index
and ST_Contains(geometry, NEW.geometry)
and not ST_Equals(geometry, NEW.geometry)
and geometry && NEW.geometry
and geometry ~ NEW.geometry -- needed because ST_Relate does not do bbox cover test
and ST_Relate(geometry, NEW.geometry, 'T*T***FF*') -- contains but not equal
ORDER BY prank.address_rank desc LIMIT 1
LOOP
NEW.rank_address := location.rank_address + 2;
@@ -1005,8 +983,9 @@ BEGIN
and rank_address between 1 and 25 -- select right index
and ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') -- select right index
and prank.address_rank >= NEW.rank_address
and ST_Contains(geometry, NEW.geometry)
and not ST_Equals(geometry, NEW.geometry)
and geometry && NEW.geometry
and geometry ~ NEW.geometry -- needed because ST_Relate does not do bbox cover test
and ST_Relate(geometry, NEW.geometry, 'T*T***FF*') -- contains but not equal
ORDER BY prank.address_rank desc LIMIT 1
LOOP
NEW.rank_address := location.rank_address + 2;

View File

@@ -29,7 +29,7 @@ BEGIN
RETURN 0.02;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Return an approximate update radius according to the search rank.
@@ -60,7 +60,7 @@ BEGIN
RETURN 0;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Compute a base address rank from the extent of the given geometry.
--
@@ -88,10 +88,6 @@ BEGIN
area := area / 3;
ELSIF country_code IN ('bo', 'ar', 'sd', 'mn', 'in', 'et', 'cd', 'mz', 'ly', 'cl', 'zm') THEN
area := area / 2;
ELSIF country_code IN ('sg', 'ws', 'st', 'kn') THEN
area := area * 5;
ELSIF country_code IN ('dm', 'mt', 'lc', 'gg', 'sc', 'nr') THEN
area := area * 20;
END IF;
IF area > 1 THEN
@@ -111,7 +107,7 @@ BEGIN
RETURN 23;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Guess a ranking for postcodes from country and postcode format.
@@ -171,7 +167,7 @@ BEGIN
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Get standard search and address rank for an object.
@@ -240,7 +236,7 @@ BEGIN
END IF;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION get_addr_tag_rank(key TEXT, country TEXT,
OUT from_rank SMALLINT,
@@ -287,7 +283,7 @@ BEGIN
END LOOP;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION weigh_search(search_vector INT[],
@@ -308,4 +304,4 @@ BEGIN
RETURN def_weight;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;

View File

@@ -2,7 +2,7 @@
--
-- This file is part of Nominatim. (https://nominatim.org)
--
-- Copyright (C) 2025 by the Nominatim developer community.
-- Copyright (C) 2022 by the Nominatim developer community.
-- For a full list of authors see the git log.
-- Assorted helper functions for the triggers.
@@ -14,17 +14,17 @@ DECLARE
geom_type TEXT;
BEGIN
geom_type := ST_GeometryType(place);
IF geom_type = 'ST_Point' THEN
IF geom_type = ' ST_Point' THEN
RETURN place;
END IF;
IF geom_type = 'ST_LineString' THEN
RETURN ST_ReducePrecision(ST_LineInterpolatePoint(place, 0.5), 0.0000001);
RETURN ST_LineInterpolatePoint(place, 0.5);
END IF;
RETURN ST_ReducePrecision(ST_PointOnSurface(place), 0.0000001);
RETURN ST_PointOnSurface(place);
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION geometry_sector(partition INTEGER, place GEOMETRY)
@@ -34,7 +34,7 @@ BEGIN
RETURN (partition*1000000) + (500-ST_X(place)::INTEGER)*1000 + (500-ST_Y(place)::INTEGER);
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
@@ -60,7 +60,7 @@ BEGIN
RETURN r;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Return the node members with a given label from a relation member list
-- as a set.
@@ -88,7 +88,7 @@ BEGIN
RETURN;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION get_rel_node_members(members JSONB, memberLabels TEXT[])
@@ -107,7 +107,7 @@ BEGIN
RETURN;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Copy 'name' to or from the default language.
@@ -136,7 +136,7 @@ BEGIN
END IF;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
-- Find the nearest artificial postcode for the given geometry.
@@ -172,7 +172,7 @@ BEGIN
RETURN outcode;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION get_country_code(place geometry)
@@ -233,7 +233,7 @@ BEGIN
RETURN NULL;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION get_country_language_code(search_country_code VARCHAR(2))
@@ -251,7 +251,7 @@ BEGIN
RETURN NULL;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION get_partition(in_country_code VARCHAR(10))
@@ -268,7 +268,7 @@ BEGIN
RETURN 0;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
-- Find the parent of an address with addr:street/addr:place tag.
@@ -299,7 +299,7 @@ BEGIN
RETURN parent_place_id;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION delete_location(OLD_place_id BIGINT)
@@ -337,7 +337,7 @@ BEGIN
ST_Project(geom::geography, radius, 3.9269908)::geometry));
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION add_location(place_id BIGINT, country_code varchar(2),
@@ -455,7 +455,7 @@ BEGIN
RETURN;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION split_geometry(geometry GEOMETRY)
@@ -483,7 +483,7 @@ BEGIN
RETURN;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION simplify_large_polygons(geometry GEOMETRY)
RETURNS GEOMETRY
@@ -497,7 +497,7 @@ BEGIN
RETURN geometry;
END;
$$
LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION place_force_delete(placeid BIGINT)
@@ -623,34 +623,3 @@ BEGIN
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION place_update_entrances(placeid BIGINT, osmid BIGINT)
RETURNS INTEGER
AS $$
DECLARE
entrance RECORD;
osm_ids BIGINT[];
BEGIN
osm_ids := '{}';
FOR entrance in SELECT osm_id, type, geometry, extratags
FROM place_entrance
WHERE osm_id IN (SELECT unnest(nodes) FROM planet_osm_ways WHERE id=osmid)
LOOP
osm_ids := array_append(osm_ids, entrance.osm_id);
INSERT INTO placex_entrance (place_id, osm_id, type, location, extratags)
VALUES (placeid, entrance.osm_id, entrance.type, entrance.geometry, entrance.extratags)
ON CONFLICT (place_id, osm_id) DO UPDATE
SET type = excluded.type, location = excluded.location, extratags = excluded.extratags;
END LOOP;
IF array_length(osm_ids, 1) > 0 THEN
DELETE FROM placex_entrance WHERE place_id=placeid AND NOT osm_id=ANY(osm_ids);
ELSE
DELETE FROM placex_entrance WHERE place_id=placeid;
END IF;
RETURN NULL;
END;
$$
LANGUAGE plpgsql;

View File

@@ -244,25 +244,6 @@ CREATE UNIQUE INDEX idx_postcode_id ON location_postcode USING BTREE (place_id)
CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry) {{db.tablespace.address_index}};
GRANT SELECT ON location_postcode TO "{{config.DATABASE_WEBUSER}}" ;
-- Table to store location of entrance nodes
DROP TABLE IF EXISTS placex_entrance;
CREATE TABLE placex_entrance (
place_id BIGINT NOT NULL,
osm_id BIGINT NOT NULL,
type TEXT NOT NULL,
location GEOMETRY(Point, 4326) NOT NULL,
extratags HSTORE
);
CREATE UNIQUE INDEX idx_placex_entrance_place_id_osm_id ON placex_entrance
USING BTREE (place_id, osm_id) {{db.tablespace.search_index}};
GRANT SELECT ON placex_entrance TO "{{config.DATABASE_WEBUSER}}" ;
-- Create an index on the place table for lookups to populate the entrance
-- table
CREATE INDEX IF NOT EXISTS idx_placex_entrance_lookup ON place
USING BTREE (osm_id)
WHERE class IN ('routing:entrance', 'entrance');
DROP TABLE IF EXISTS import_polygon_error;
CREATE TABLE import_polygon_error (
osm_id BIGINT,

View File

@@ -12,7 +12,7 @@ CREATE OR REPLACE FUNCTION token_get_name_search_tokens(info JSONB)
RETURNS INTEGER[]
AS $$
SELECT (info->>'names')::INTEGER[]
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
-- Get tokens for matching the place name against others.
@@ -22,7 +22,7 @@ CREATE OR REPLACE FUNCTION token_get_name_match_tokens(info JSONB)
RETURNS INTEGER[]
AS $$
SELECT (info->>'names')::INTEGER[]
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
-- Return the housenumber tokens applicable for the place.
@@ -30,7 +30,7 @@ CREATE OR REPLACE FUNCTION token_get_housenumber_search_tokens(info JSONB)
RETURNS INTEGER[]
AS $$
SELECT (info->>'hnr_tokens')::INTEGER[]
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
-- Return the housenumber in the form that it can be matched during search.
@@ -38,77 +38,77 @@ CREATE OR REPLACE FUNCTION token_normalized_housenumber(info JSONB)
RETURNS TEXT
AS $$
SELECT info->>'hnr';
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_is_street_address(info JSONB)
RETURNS BOOLEAN
AS $$
SELECT info->>'street' is not null or info->>'place' is null;
$$ LANGUAGE SQL IMMUTABLE PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION token_has_addr_street(info JSONB)
RETURNS BOOLEAN
AS $$
SELECT info->>'street' is not null and info->>'street' != '{}';
$$ LANGUAGE SQL IMMUTABLE PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION token_has_addr_place(info JSONB)
RETURNS BOOLEAN
AS $$
SELECT info->>'place' is not null;
$$ LANGUAGE SQL IMMUTABLE PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION token_matches_street(info JSONB, street_tokens INTEGER[])
RETURNS BOOLEAN
AS $$
SELECT (info->>'street')::INTEGER[] && street_tokens
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_matches_place(info JSONB, place_tokens INTEGER[])
RETURNS BOOLEAN
AS $$
SELECT (info->>'place')::INTEGER[] <@ place_tokens
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_addr_place_search_tokens(info JSONB)
RETURNS INTEGER[]
AS $$
SELECT (info->>'place')::INTEGER[]
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_get_address_keys(info JSONB)
RETURNS SETOF TEXT
AS $$
SELECT * FROM jsonb_object_keys(info->'addr');
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_get_address_search_tokens(info JSONB, key TEXT)
RETURNS INTEGER[]
AS $$
SELECT (info->'addr'->>key)::INTEGER[];
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_matches_address(info JSONB, key TEXT, tokens INTEGER[])
RETURNS BOOLEAN
AS $$
SELECT (info->'addr'->>key)::INTEGER[] <@ tokens;
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION token_get_postcode(info JSONB)
RETURNS TEXT
AS $$
SELECT info->>'postcode';
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
-- Return token info that should be saved permanently in the database.
@@ -116,7 +116,7 @@ CREATE OR REPLACE FUNCTION token_strip_info(info JSONB)
RETURNS JSONB
AS $$
SELECT NULL::JSONB;
$$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
$$ LANGUAGE SQL IMMUTABLE STRICT;
--------------- private functions ----------------------------------------------
@@ -128,14 +128,16 @@ DECLARE
partial_terms TEXT[] = '{}'::TEXT[];
term TEXT;
term_id INTEGER;
term_count INTEGER;
BEGIN
SELECT min(word_id) INTO full_token
FROM word WHERE word = norm_term and type = 'W';
IF full_token IS NULL THEN
full_token := nextval('seq_word');
INSERT INTO word (word_id, word_token, type, word)
SELECT full_token, lookup_term, 'W', norm_term
INSERT INTO word (word_id, word_token, type, word, info)
SELECT full_token, lookup_term, 'W', norm_term,
json_build_object('count', 0)
FROM unnest(lookup_terms) as lookup_term;
END IF;
@@ -148,67 +150,14 @@ BEGIN
partial_tokens := '{}'::INT[];
FOR term IN SELECT unnest(partial_terms) LOOP
SELECT min(word_id) INTO term_id
SELECT min(word_id), max(info->>'count') INTO term_id, term_count
FROM word WHERE word_token = term and type = 'w';
IF term_id IS NULL THEN
term_id := nextval('seq_word');
INSERT INTO word (word_id, word_token, type)
VALUES (term_id, term, 'w');
END IF;
partial_tokens := array_merge(partial_tokens, ARRAY[term_id]);
END LOOP;
END;
$$
LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION getorcreate_full_word(norm_term TEXT,
lookup_terms TEXT[],
lookup_norm_terms TEXT[],
OUT full_token INT,
OUT partial_tokens INT[])
AS $$
DECLARE
partial_terms TEXT[] = '{}'::TEXT[];
term TEXT;
term_id INTEGER;
BEGIN
SELECT min(word_id) INTO full_token
FROM word WHERE word = norm_term and type = 'W';
IF full_token IS NULL THEN
full_token := nextval('seq_word');
IF lookup_norm_terms IS NULL THEN
INSERT INTO word (word_id, word_token, type, word)
SELECT full_token, lookup_term, 'W', norm_term
FROM unnest(lookup_terms) as lookup_term;
ELSE
INSERT INTO word (word_id, word_token, type, word, info)
SELECT full_token, t.lookup, 'W', norm_term,
CASE WHEN norm_term = t.norm THEN null
ELSE json_build_object('lookup', t.norm) END
FROM unnest(lookup_terms, lookup_norm_terms) as t(lookup, norm);
END IF;
END IF;
FOR term IN SELECT unnest(string_to_array(unnest(lookup_terms), ' ')) LOOP
term := trim(term);
IF NOT (ARRAY[term] <@ partial_terms) THEN
partial_terms := partial_terms || term;
END IF;
END LOOP;
partial_tokens := '{}'::INT[];
FOR term IN SELECT unnest(partial_terms) LOOP
SELECT min(word_id) INTO term_id
FROM word WHERE word_token = term and type = 'w';
IF term_id IS NULL THEN
term_id := nextval('seq_word');
INSERT INTO word (word_id, word_token, type)
VALUES (term_id, term, 'w');
term_count := 0;
INSERT INTO word (word_id, word_token, type, info)
VALUES (term_id, term, 'w', json_build_object('count', term_count));
END IF;
partial_tokens := array_merge(partial_tokens, ARRAY[term_id]);

View File

@@ -1,4 +1,4 @@
site_name: Nominatim 5.2.0 Manual
site_name: Nominatim 5.0.0 Manual
theme:
font: false
name: material
@@ -67,7 +67,6 @@ markdown_extensions:
- codehilite
- admonition
- pymdownx.superfences
- pymdownx.blocks.html
- pymdownx.tabbed:
alternate_style: true
- def_list

View File

@@ -3,7 +3,7 @@
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2025 by the Nominatim developer community.
# Copyright (C) 2024 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Helper script for development to run nominatim from the source directory.
@@ -15,4 +15,4 @@ sys.path.insert(1, str((Path(__file__) / '..' / 'src').resolve()))
from nominatim_db import cli
exit(cli.nominatim())
exit(cli.nominatim(module_dir=None, osm2pgsql_path=None))

View File

@@ -1,232 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -0,0 +1 @@
../../COPYING

View File

@@ -2,7 +2,7 @@
name = "nominatim-api"
description = "A tool for building a database of OpenStreetMap for geocoding and for searching the database. Search library."
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.7"
license = 'GPL-3.0-or-later'
maintainers = [
{ name = "Sarah Hoffmann", email = "lonvia@denofr.de" },
@@ -15,7 +15,6 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"async-timeout",
"python-dotenv",
"pyYAML>=5.1",
"SQLAlchemy>=1.4.31",

View File

@@ -1,232 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -0,0 +1 @@
../../COPYING

View File

@@ -2,7 +2,7 @@
name = "nominatim-db"
description = "A tool for building a database of OpenStreetMap for geocoding and for searching the database. Database backend."
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.7"
license = 'GPL-3.0-or-later'
maintainers = [
{ name = "Sarah Hoffmann", email = "lonvia@denofr.de" },
@@ -19,6 +19,7 @@ dependencies = [
"python-dotenv",
"jinja2",
"pyYAML>=5.1",
"datrie",
"psutil",
"PyICU"
]

View File

@@ -2,4 +2,4 @@
from nominatim_db import cli
exit(cli.nominatim())
exit(cli.nominatim(osm2pgsql_path=None))

View File

@@ -21,7 +21,7 @@
"croft" : 20,
"subdivision" : 22,
"allotments" : 22,
"neighbourhood" : 24,
"neighbourhood" : [20, 22],
"quarter" : [20, 22],
"isolated_dwelling" : [22, 25],
"farm" : [22, 25],
@@ -48,20 +48,17 @@
"" : [25, 0]
},
"landuse" : {
"residential" : 24,
"farm" : 24,
"farmyard" : 24,
"industrial" : 24,
"commercial" : 24,
"allotments" : 24,
"retail" : 24,
"" : [24, 0]
"residential" : 22,
"farm" : 22,
"farmyard" : 22,
"industrial" : 22,
"commercial" : 22,
"allotments" : 22,
"retail" : 22,
"" : [22, 0]
},
"leisure" : {
"park" : [24, 0],
"nature_reserve" : [24, 0],
"garden": [25, 0],
"common": [25, 0]
"park" : [24, 0]
},
"natural" : {
"peak" : [18, 0],
@@ -219,14 +216,6 @@
}
}
},
{ "countries" : ["sa"],
"tags" : {
"place" : {
"province" : 12,
"municipality" : 18
}
}
},
{ "countries" : ["sk"],
"tags" : {
"boundary" : {
@@ -239,17 +228,6 @@
"administrative11" : 20
}
}
},
{ "countries" : ["jp"],
"tags" : {
"boundary" : {
"administrative7" : 16,
"administrative8" : 18,
"administrative9" : 20,
"administrative10" : 22,
"administrative11" : 24
}
}
}
]

View File

@@ -97,6 +97,7 @@ name:
na: Andorra
ne: एण्डोरा
nl: Andorra
nn: Andorra
"no": Andorra
nv: Andówa
oc: Andòrra

View File

@@ -74,7 +74,6 @@ name:
mt: Emirati Għarab Magħquda
my: အာရပ်စော်ဘွားများပြည်ထောင်စုနိုင်ငံ
na: Emireitit Arabiya
nb: De forente arabiske emirater
ne: संयुक्त अरब इमिरेट्स
nl: Verenigde Arabische Emiraten
nn: Dei sameinte arabiske emirata

View File

@@ -96,6 +96,7 @@ name:
na: Apeganitan
ne: अफगानिस्तान
nl: Afghanistan
nn: Afghanistan
"no": Afghanistan
oc: Afganistan
om: Afgaanistaan

View File

@@ -86,8 +86,10 @@ name:
mt: Antigwa u Barbuda
my: အင်တီဂွါနှင့် ဘာဘူဒါ
na: Antigua me Barbuda
nb: Antigua og Barbuda
ne: एन्टिगुआ र बर्बुडा
nl: Antigua en Barbuda
nn: Antigua og Barbuda
"no": Antigua og Barbuda
nv: Antíígwa dóó Hashkʼaan Bikéyah Yázhí
oc: Antigua e Barbuda

View File

@@ -50,6 +50,7 @@ name:
ms: Anguilla
ne: एन्गुला
nl: Anguilla
nn: Anguilla
"no": Anguilla
oc: Anguilla
pa: ਐਂਗੁਈਲਾ

View File

@@ -101,6 +101,7 @@ name:
na: Arbainiya
ne: अल्बानिया
nl: Albanië
nn: Albania
"no": Albania
nv: Dziłigaii Bikéyah
oc: Albania

View File

@@ -99,6 +99,7 @@ name:
na: Arminiya
ne: आर्मेनिया
nl: Armenië
nn: Armenia
"no": Armenia
nv: Aooméénii Bikéyah
oc: Armenia

View File

@@ -90,6 +90,7 @@ name:
na: Angora
ne: अंगोला
nl: Angola
nn: Angola
"no": Angola
nv: Angóola
ny: Angola

View File

@@ -99,6 +99,7 @@ name:
na: Ardjentina
ne: अर्जेन्टिना
nl: Argentinië
nn: Argentina
"no": Argentina
nv: Béésh Łigaii Bikéyah
oc: Argentina

View File

@@ -93,7 +93,6 @@ name:
mt: Awstrija
my: သြစတြီးယားနိုင်ငံ
na: Oteriya
nb: Østerrike
ne: अष्ट्रीया
nl: Oostenrijk
nn: Austerrike

View File

@@ -94,6 +94,7 @@ name:
na: Otereiriya
ne: अष्ट्रेलिया
nl: Australië
nn: Australia
"no": Australia
nv: Nahatʼeʼiitsoh Bikéyah
oc: Austràlia

View File

@@ -96,8 +96,10 @@ name:
mt: Ażerbajġan
my: အဇာဘိုင်ဂျန်နိုင်ငံ
na: Aderbaidjan
nb: Aserbajdsjan
ne: अजरबैजान
nl: Azerbeidzjan
nn: Aserbajdsjan
"no": Aserbajdsjan
nv: Azééwii Bikéyah
ny: Azerbaijan

View File

@@ -94,6 +94,7 @@ name:
na: Boteniya me Erdegobina
ne: बोस्निया र हर्जगोभिना
nl: Bosnië en Herzegovina
nn: Bosnia-Hercegovina
"no": Bosnia-Hercegovina
nv: Bosna dóó Hetsog Bikéyah
oc: Bòsnia e Ercegovina

View File

@@ -77,6 +77,7 @@ name:
na: Barbadot
ne: बार्बाडोस
nl: Barbados
nn: Barbados
"no": Barbados
oc: Barbados
om: Baarbeedoos

View File

@@ -29,7 +29,6 @@ name:
lt: Bangladešas
lv: Bangladeša
mn: Бангладеш
"no": Bangladesh
pl: Bangladesz
pt: Bangladesh
ru: Бангладеш

View File

@@ -95,8 +95,10 @@ name:
mt: Belġju
my: ဘယ်လ်ဂျီယမ်နိုင်ငံ
na: Berdjiyum
nb: Belgia
ne: बेल्जियम
nl: België
nn: Belgia
"no": Belgia
oc: Belgica
om: Beeljiyeem

View File

@@ -88,6 +88,7 @@ name:
na: Burkinabato
ne: बुर्किना फासो
nl: Burkina Faso
nn: Burkina Faso
"no": Burkina Faso
oc: Burkina Faso
om: Burkinaa Faasoo

View File

@@ -93,6 +93,7 @@ name:
na: Borgeriya
ne: बुल्गेरिया
nl: Bulgarije
nn: Bulgaria
"no": Bulgaria
nv: Bálgaa Bikéyah
oc: Bulgaria

View File

@@ -91,6 +91,7 @@ name:
na: Bahrain
ne: बहराइन
nl: Bahrein
nn: Bahrain
"no": Bahrain
oc: Bahrayn
om: Baahireen

View File

@@ -88,6 +88,7 @@ name:
na: Burundi
ne: बुरूण्डी
nl: Burundi
nn: Burundi
"no": Burundi
oc: Burundi
om: Buruundii

View File

@@ -91,6 +91,7 @@ name:
na: Benin
ne: बेनिन
nl: Benin
nn: Benin
"no": Benin
oc: Benin
om: Beeniin

View File

@@ -25,7 +25,6 @@ name:
lv: Bermudu salas
mk: Бермуда
mn: Бермудын Арал
"no": Bermuda
oc: Bermudas
pl: Bermudy
pt: Bermudas

View File

@@ -91,6 +91,7 @@ name:
na: Brunei
ne: ब्रुनेई
nl: Brunei
nn: Brunei
"no": Brunei
ny: Brunei
oc: Brunei

View File

@@ -94,6 +94,7 @@ name:
na: Boribiya
ne: बोलिभिया
nl: Bolivia
nn: Bolivia
"no": Bolivia
nv: Bolíbiya
oc: Bolívia

View File

@@ -99,6 +99,7 @@ name:
na: Bradir
ne: ब्राजिल
nl: Brazilië
nn: Brasil
"no": Brasil
nv: Bwazííl
oc: Brasil

View File

@@ -85,6 +85,7 @@ name:
na: Bahamat
ne: बहामस
nl: Bahama's
nn: Bahamas
"no": Bahamas
oc: Las Bahamas
om: Bahamaas

View File

@@ -92,6 +92,7 @@ name:
na: Butan
ne: भूटान
nl: Bhutan
nn: Bhutan
"no": Bhutan
nv: Bikéyah
oc: Botan

View File

@@ -90,6 +90,7 @@ name:
na: Botwana
ne: बोत्स्वाना
nl: Botswana
nn: Botswana
"no": Botswana
nv: Tswana Dineʼé Bikéyah
oc: Botswana

View File

@@ -83,7 +83,8 @@ name:
na: Berarut
ne: बेलारुस
nl: Wit-Rusland
"no": Belarus
nn: Kviterussland
"no": Hviterussland
oc: Bielorussia
or: ବେଲାଋଷ
os: Белорусси

View File

@@ -85,6 +85,7 @@ name:
na: Berij
ne: बेलिज
nl: Belize
nn: Belize
"no": Belize
oc: Belize
om: Beliiz

View File

@@ -94,6 +94,7 @@ name:
na: Kanada
ne: क्यानाडा
nl: Canada
nn: Canada
"no": Canada
nv: Deeteel Bikéyah
oc: Canadà

View File

@@ -74,6 +74,7 @@ name:
na: Ripubrikit Engame Kongo
ne: प्रजातान्त्रिक गणतन्त्र कंगो
nl: Democratische Republiek Congo
nn: Den demokratiske republikken Kongo
"no": Den demokratiske republikken Kongo
nv: Kéyah Káango Shádiʼááhjí Siʼánígíí
oc: Republica Democratica de Còngo

View File

@@ -72,7 +72,6 @@ name:
mt: Repubblika Ċentru-Afrikana
my: ဗဟိုအာဖရိကသမ္မတနိုင်ငံ
na: Ripubrikin Aprika Yugaga
nb: Den sentralafrikanske republikk
ne: मध्य अफ्रिकी गणतन्त्र
nl: Centraal-Afrikaanse Republiek
nn: Den sentralafrikanske republikken

View File

@@ -70,6 +70,7 @@ name:
na: Ripubrikin Kongo
ne: कङ्गो
nl: Congo-Brazzaville
nn: Kongo-Brazzaville
"no": Republikken Kongo
nv: Kéyah Káango Náhookǫsjí Siʼánígíí
oc: Republica de Còngo

View File

@@ -84,6 +84,7 @@ name:
na: Switzerland
ne: स्विजरल्याण्ड
nl: Zwitserland
nn: Sveits
"no": Sveits
nv: Swis Bikéyah
oc: Soïssa

View File

@@ -75,7 +75,6 @@ name:
mt: Kosta tal-Avorju
my: အိုင်ဗရီကို့စ်နိုင်ငံ
na: Aibori Kot
nb: Elfenbenskysten
ne: आइभरी कोस्ट
nl: Ivoorkust
nn: Elfenbeinskysten

View File

@@ -79,7 +79,6 @@ name:
ms: Kepulauan Cook
mt: Gżejjer Cook
my: ကွတ် ကျွန်းစု
nb: Cookøyene
ne: कुक टापु
nl: Cookeilanden
nn: Cookøyane

View File

@@ -103,6 +103,7 @@ name:
na: Tsire
ne: चिली
nl: Chili
nn: Chile
"no": Chile
nv: Chíilii
ny: Chile

View File

@@ -79,6 +79,7 @@ name:
na: Kamerun
ne: क्यामेरून
nl: Kameroen
nn: Kamerun
"no": Kamerun
nv: Táłtłʼááh Chʼosh Daadánígíí Bitooh
oc: Cameron

View File

@@ -101,8 +101,10 @@ name:
mt: Ċina
my: တရုတ်
na: Tsiene
nb: Kina
ne: चीन
nl: China
nn: Kina
"no": Kina
nv: Tsiiʼyishbizhí Dineʼé Bikéyah
ny: China

View File

@@ -82,6 +82,7 @@ name:
na: Korombiya
ne: कोलम्बिया
nl: Colombia
nn: Colombia
"no": Colombia
nv: Kolámbiya
oc: Colómbia

View File

@@ -81,6 +81,7 @@ name:
na: Kosta Rika
ne: कोस्टारिका
nl: Costa Rica
nn: Costa Rica
"no": Costa Rica
oc: Còsta Rica
om: Kostaa Rikaa

View File

@@ -78,6 +78,7 @@ name:
na: Kiuba
ne: क्युबा
nl: Cuba
nn: Cuba
"no": Cuba
nv: Kyóoba
oc: Cuba

View File

@@ -36,7 +36,6 @@ name:
mk: Зелен ’Рт
mn: Кабо-Верде
nl: Kaapverdië
"no": Kapp Verde
pl: Republika Zielonego Przylądka
pt: Cabo Verde
ru: Кабо-Верде

View File

@@ -77,8 +77,10 @@ name:
mt: Ċipru
my: ဆိုက်ပရပ်စ်နိုင်ငံ
na: Taiprus
nb: Kypros
ne: साइप्रस
nl: Cyprus
nn: Kypros
"no": Kypros
nv: Béésh Łichíiʼii Bikéyah
oc: Chipre

View File

@@ -93,6 +93,7 @@ name:
na: Ripubrikin Tsiek
ne: चेक गणतन्त्र
nl: Tsjechië
nn: Tsjekkia
"no": Tsjekkia
nv: Chek Bikéyah
oc: Republica Chèca

Some files were not shown because too many files have changed in this diff Show More