Compare commits

...

10 Commits

Author SHA1 Message Date
Sarah Hoffmann
896a40b7d5 prepare release 4.4.1 2024-08-20 13:54:37 +02:00
Sarah Hoffmann
1e71085004 update CI scripts 2024-08-20 13:54:37 +02:00
Sarah Hoffmann
3c05d98b80 make sure SQLAlchemy can handle the loaded dialect
The psycopg dialect was only added in SQLAlchemy 2.0. To avoid loading
errors when SQLAlchemy 1.4 is installed together with psycopg3,
check that the dialect is really available.
2024-08-20 10:10:09 +02:00
Sarah Hoffmann
7bbdf57b08 restrict interpolation housenumbers to 0-999999
Ensures that the numbers fit into integers.
2024-08-20 09:45:01 +02:00
Markus Döring
5e91b78ff4 update Search.md, fix typo (#3454) 2024-08-20 09:43:43 +02:00
Sarah Hoffmann
ad72641424 restrict invalidation of child objects on large street features
When streets become very large, it is more likely a mapping error.
So ignore such changes.
2024-08-20 09:43:20 +02:00
marc tobias
75130e4332 docs: use nominatim-project everywhere 2024-08-20 09:41:42 +02:00
marc tobias
47b41ed510 Import documentation: reverse-only only a little faster import [skip ci] 2024-08-20 09:40:52 +02:00
marc tobias
b4e2e7de16 geocodejson: admin level output should only print boundaries 2024-08-20 09:40:21 +02:00
marc tobias
1c3ed66ca1 docs: correct URL of an internal link 2024-08-20 09:39:06 +02:00
11 changed files with 35 additions and 20 deletions

View File

@@ -65,7 +65,7 @@ jobs:
- name: Unpack Nominatim - name: Unpack Nominatim
run: tar xf nominatim-src.tar.bz2 run: tar xf nominatim-src.tar.bz2
- uses: actions/setup-python@v4 - uses: actions/setup-python@v5
with: with:
python-version: 3.7 python-version: 3.7
if: matrix.flavour == 'oldstuff' if: matrix.flavour == 'oldstuff'
@@ -93,7 +93,7 @@ jobs:
if: matrix.flavour != 'oldstuff' if: matrix.flavour != 'oldstuff'
- name: Install newer pytest-asyncio - name: Install newer pytest-asyncio
run: pip3 install -U pytest-asyncio==0.21.1 run: pip3 install -U pytest-asyncio
if: matrix.flavour == 'ubuntu-20' if: matrix.flavour == 'ubuntu-20'
- name: Install test prerequsites (from pip for Ubuntu 18) - name: Install test prerequsites (from pip for Ubuntu 18)
@@ -105,12 +105,12 @@ jobs:
- name: Install latest pylint - name: Install latest pylint
run: pip3 install -U pylint run: pip3 install -U pylint
if: matrix.flavour != 'oldstuff' if: matrix.flavour == 'ubuntu-22'
- name: Python linting - name: Python linting
run: python3 -m pylint nominatim run: python3 -m pylint nominatim
working-directory: Nominatim working-directory: Nominatim
if: matrix.flavour != 'oldstuff' if: matrix.flavour == 'ubuntu-22'
- name: Python unit tests - name: Python unit tests
run: python3 -m pytest test/python run: python3 -m pytest test/python

View File

@@ -20,7 +20,7 @@ project(nominatim)
set(NOMINATIM_VERSION_MAJOR 4) set(NOMINATIM_VERSION_MAJOR 4)
set(NOMINATIM_VERSION_MINOR 4) set(NOMINATIM_VERSION_MINOR 4)
set(NOMINATIM_VERSION_PATCH 0) set(NOMINATIM_VERSION_PATCH 1)
set(NOMINATIM_VERSION "${NOMINATIM_VERSION_MAJOR}.${NOMINATIM_VERSION_MINOR}.${NOMINATIM_VERSION_PATCH}") set(NOMINATIM_VERSION "${NOMINATIM_VERSION_MAJOR}.${NOMINATIM_VERSION_MINOR}.${NOMINATIM_VERSION_PATCH}")

View File

@@ -1,3 +1,10 @@
4.4.1
* fix geocodejson output: admin level output should only print boundaries
* updating: restrict invalidation of child objects on large street features
* restrict valid interpolation house numbers to 0-999999
* fix import error when SQLAlchemy 1.4 and psycopg3 are installed
* various typo fixes in the documentation
4.4.0 4.4.0
* add export to SQLite database and SQLite support for the frontend * add export to SQLite database and SQLite support for the frontend
* switch to Python frontend as the default frontend * switch to Python frontend as the default frontend

View File

@@ -14,15 +14,15 @@ to a single Nominatim setup: configuration, extra data, etc. Create a project
directory apart from the Nominatim software and change into the directory: directory apart from the Nominatim software and change into the directory:
``` ```
mkdir ~/nominatim-planet mkdir ~/nominatim-project
cd ~/nominatim-planet cd ~/nominatim-project
``` ```
In the following, we refer to the project directory as `$PROJECT_DIR`. To be In the following, we refer to the project directory as `$PROJECT_DIR`. To be
able to copy&paste instructions, you can export the appropriate variable: able to copy&paste instructions, you can export the appropriate variable:
``` ```
export PROJECT_DIR=~/nominatim-planet export PROJECT_DIR=~/nominatim-project
``` ```
The Nominatim tool assumes per default that the current working directory is The Nominatim tool assumes per default that the current working directory is
@@ -153,7 +153,7 @@ if you plan to use the installation only for exports to a
[photon](https://photon.komoot.io/) database, then you can set up a database [photon](https://photon.komoot.io/) database, then you can set up a database
without search indexes. Add `--reverse-only` to your setup command above. without search indexes. Add `--reverse-only` to your setup command above.
This saves about 5% of disk space. This saves about 5% of disk space, import time won't be significant faster.
### Filtering Imported Data ### Filtering Imported Data
@@ -228,7 +228,7 @@ to load the OSM data into the PostgreSQL database. This step is very demanding
in terms of RAM usage. osm2pgsql and PostgreSQL are running in parallel at in terms of RAM usage. osm2pgsql and PostgreSQL are running in parallel at
this point. PostgreSQL blocks at least the part of RAM that has been configured this point. PostgreSQL blocks at least the part of RAM that has been configured
with the `shared_buffers` parameter during with the `shared_buffers` parameter during
[PostgreSQL tuning](Installation.md#postgresql-tuning) [PostgreSQL tuning](Installation.md#tuning-the-postgresql-database)
and needs some memory on top of that. osm2pgsql needs at least 2GB of RAM for and needs some memory on top of that. osm2pgsql needs at least 2GB of RAM for
its internal data structures, potentially more when it has to process very large its internal data structures, potentially more when it has to process very large
relations. In addition it needs to maintain a cache for node locations. The size relations. In addition it needs to maintain a cache for node locations. The size

View File

@@ -165,7 +165,7 @@ results and thus give a preference to some results over others.
|-----------| ----- | ------- | |-----------| ----- | ------- |
| countrycodes | comma-separated list of country codes | _unset_ | | countrycodes | comma-separated list of country codes | _unset_ |
Filer that limits the search results to one or more countries. Filter that limits the search results to one or more countries.
The country code must be the The country code must be the
[ISO 3166-1alpha2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code [ISO 3166-1alpha2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code
of the country, e.g. `gb` for the United Kingdom, `de` for Germany. of the country, e.g. `gb` for the United Kingdom, `de` for Germany.

View File

@@ -219,10 +219,11 @@ BEGIN
-- formatted postcode and therefore 'postcode' contains a derived -- formatted postcode and therefore 'postcode' contains a derived
-- variant. -- variant.
CASE WHEN address ? 'postcode' THEN placex.postcode ELSE NULL::text END as postcode, CASE WHEN address ? 'postcode' THEN placex.postcode ELSE NULL::text END as postcode,
substring(address->'housenumber','[0-9]+')::integer as hnr (address->'housenumber')::integer as hnr
FROM placex, generate_series(1, array_upper(waynodes, 1)) nodeidpos FROM placex, generate_series(1, array_upper(waynodes, 1)) nodeidpos
WHERE osm_type = 'N' and osm_id = waynodes[nodeidpos]::BIGINT WHERE osm_type = 'N' and osm_id = waynodes[nodeidpos]::BIGINT
and address is not NULL and address ? 'housenumber' and address is not NULL and address ? 'housenumber'
and address->'housenumber' ~ '^[0-9]{1,6}$'
and ST_Distance(NEW.linegeo, geometry) < 0.0005 and ST_Distance(NEW.linegeo, geometry) < 0.0005
ORDER BY nodeidpos ORDER BY nodeidpos
LOOP LOOP

View File

@@ -731,10 +731,12 @@ BEGIN
{% if not disable_diff_updates %} {% if not disable_diff_updates %}
-- The following is not needed until doing diff updates, and slows the main index process down -- The following is not needed until doing diff updates, and slows the main index process down
IF NEW.rank_address > 0 THEN 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 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 -- Performance: We just can't handle re-indexing for country level changes
IF st_area(NEW.geometry) < 1 THEN 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 -- mark items within the geometry for re-indexing
-- RAISE WARNING 'placex poly insert: % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type; -- RAISE WARNING 'placex poly insert: % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type;
@@ -749,9 +751,11 @@ BEGIN
or name is not null or name is not null
or (NEW.rank_address >= 16 and address ? 'place')); or (NEW.rank_address >= 16 and address ? 'place'));
END IF; END IF;
ELSE ELSEIF ST_GeometryType(NEW.geometry) not in ('ST_LineString', 'ST_MultiLineString')
OR ST_Length(NEW.geometry) < 0.5
THEN
-- mark nearby items for re-indexing, where 'nearby' depends on the features rank_search and is a complete guess :( -- mark nearby items for re-indexing, where 'nearby' depends on the features rank_search and is a complete guess :(
diameter := update_place_diameter(NEW.rank_search); diameter := update_place_diameter(NEW.rank_address);
IF diameter > 0 THEN IF diameter > 0 THEN
-- RAISE WARNING 'placex point insert: % % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type,diameter; -- RAISE WARNING 'placex point insert: % % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type,diameter;
IF NEW.rank_search >= 26 THEN IF NEW.rank_search >= 26 THEN

View File

@@ -247,7 +247,8 @@ def format_base_geocodejson(results: Union[napi.ReverseResults, napi.SearchResul
out.key('admin').start_object() out.key('admin').start_object()
if result.address_rows: if result.address_rows:
for line in result.address_rows: for line in result.address_rows:
if line.isaddress and (line.admin_level or 15) < 15 and line.local_name: if line.isaddress and (line.admin_level or 15) < 15 and line.local_name \
and line.category[0] == 'boundary' and line.category[1] == 'administrative':
out.keyval(f"level{line.admin_level}", line.local_name) out.keyval(f"level{line.admin_level}", line.local_name)
out.end_object().next() out.end_object().next()

View File

@@ -142,7 +142,7 @@ class UpdateReplication:
if not args.do_index: if not args.do_index:
LOG.fatal("Indexing cannot be disabled when running updates continuously.") LOG.fatal("Indexing cannot be disabled when running updates continuously.")
raise UsageError("Bad argument '--no-index'.") raise UsageError("Bad argument '--no-index'.")
recheck_interval = args.config.get_int('REPLICATION_RECHECK_INTERVAL') recheck_interval = args.config.get_int('REPLICATION_RECHECK_INTERVAL')
tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config) tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config)
indexer = Indexer(args.config.get_libpq_dsn(), tokenizer, args.threads or 1) indexer = Indexer(args.config.get_libpq_dsn(), tokenizer, args.threads or 1)

View File

@@ -7,15 +7,17 @@
""" """
Import the base library to use with asynchronous SQLAlchemy. Import the base library to use with asynchronous SQLAlchemy.
""" """
# pylint: disable=invalid-name # pylint: disable=invalid-name, ungrouped-imports, unused-import
from typing import Any from typing import Any
try: try:
import sqlalchemy.dialects.postgresql.psycopg
import psycopg import psycopg
PGCORE_LIB = 'psycopg' PGCORE_LIB = 'psycopg'
PGCORE_ERROR: Any = psycopg.Error PGCORE_ERROR: Any = psycopg.Error
except ModuleNotFoundError: except ModuleNotFoundError:
import sqlalchemy.dialects.postgresql.asyncpg
import asyncpg import asyncpg
PGCORE_LIB = 'asyncpg' PGCORE_LIB = 'asyncpg'
PGCORE_ERROR = asyncpg.PostgresError PGCORE_ERROR = asyncpg.PostgresError

View File

@@ -34,7 +34,7 @@ class NominatimVersion(NamedTuple):
return f"{self.major}.{self.minor}.{self.patch_level}-{self.db_patch_level}" return f"{self.major}.{self.minor}.{self.patch_level}-{self.db_patch_level}"
NOMINATIM_VERSION = NominatimVersion(4, 4, 0, 0) NOMINATIM_VERSION = NominatimVersion(4, 4, 1, 0)
POSTGRESQL_REQUIRED_VERSION = (9, 6) POSTGRESQL_REQUIRED_VERSION = (9, 6)
POSTGIS_REQUIRED_VERSION = (2, 2) POSTGIS_REQUIRED_VERSION = (2, 2)