X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e92e03e2e6b892e6dc7a931fe0e70de9315bd302..0770eaa5d04200aec75653b1ec495ba1a214eaab:/src/nominatim_db/tools/refresh.py diff --git a/src/nominatim_db/tools/refresh.py b/src/nominatim_db/tools/refresh.py index 557c43ae..80d0a74d 100644 --- a/src/nominatim_db/tools/refresh.py +++ b/src/nominatim_db/tools/refresh.py @@ -16,8 +16,7 @@ from pathlib import Path from psycopg import sql as pysql from ..config import Configuration -from ..db.connection import Connection, connect, postgis_version_tuple,\ - drop_tables +from ..db.connection import Connection, connect, drop_tables from ..db.utils import execute_file from ..db.sql_preprocessor import SQLPreprocessor @@ -25,6 +24,7 @@ LOG = logging.getLogger() OSM_TYPE = {'N': 'node', 'W': 'way', 'R': 'relation'} + def _add_address_level_rows_from_entry(rows: MutableSequence[Tuple[Any, ...]], entry: Mapping[str, Any]) -> None: """ Converts a single entry from the JSON format for address rank @@ -51,7 +51,7 @@ def load_address_levels(conn: Connection, table: str, levels: Sequence[Mapping[s The table has the following columns: country, class, type, rank_search, rank_address """ - rows: List[Tuple[Any, ...]] = [] + rows: List[Tuple[Any, ...]] = [] for entry in levels: _add_address_level_rows_from_entry(rows, entry) @@ -189,16 +189,11 @@ def import_secondary_importance(dsn: str, data_path: Path, ignore_errors: bool = if not datafile.exists(): return 1 - with connect(dsn) as conn: - postgis_version = postgis_version_tuple(conn) - if postgis_version[0] < 3: - LOG.error('PostGIS version is too old for using OSM raster data.') - return 2 - execute_file(dsn, datafile, ignore_errors=ignore_errors) return 0 + def recompute_importance(conn: Connection) -> None: """ Recompute wikipedia links and importance for all entries in placex. This is a long-running operations that must not be executed in