X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/1ce223a83bb38585d48137633380db37aa92af2e..b4fec57b6d53f8e8a45c46ff11f13cbcbea1006a:/nominatim/tools/database_import.py?ds=inline diff --git a/nominatim/tools/database_import.py b/nominatim/tools/database_import.py index 28a10ebe..df82f9aa 100644 --- a/nominatim/tools/database_import.py +++ b/nominatim/tools/database_import.py @@ -130,9 +130,8 @@ def import_osm_data(osm_file, options, drop=False, ignore_errors=False): if drop: conn.drop_table('planet_osm_nodes') - if drop: - if options['flatnode_file']: - Path(options['flatnode_file']).unlink() + if drop and options['flatnode_file']: + Path(options['flatnode_file']).unlink() def create_tables(conn, config, reverse_only=False): @@ -272,15 +271,15 @@ def create_country_names(conn, tokenizer, languages=None): with tokenizer.name_analyzer() as analyzer: for code, name in cur: - names = [code] + names = {'countrycode' : code} if code == 'gb': - names.append('UK') + names['short_name'] = 'UK' if code == 'us': - names.append('United States') + names['short_name'] = 'United States' # country names (only in languages as provided) if name: - names.extend((v for k, v in name.items() if _include_key(k))) + names.update(((k, v) for k, v in name.items() if _include_key(k))) analyzer.add_country_names(code, names)