mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-10 21:04:07 +00:00
ignore entries without country code
This commit is contained in:
@@ -157,6 +157,7 @@ def update_postcodes(dsn, project_dir, tokenizer):
|
|||||||
ST_Centroid(ST_Collect(ST_Centroid(geometry))) as centroid
|
ST_Centroid(ST_Collect(ST_Centroid(geometry))) as centroid
|
||||||
FROM placex
|
FROM placex
|
||||||
WHERE address ? 'postcode' and geometry IS NOT null
|
WHERE address ? 'postcode' and geometry IS NOT null
|
||||||
|
and country_code is not null
|
||||||
GROUP BY country_code, pc) xx
|
GROUP BY country_code, pc) xx
|
||||||
WHERE pc is not null
|
WHERE pc is not null
|
||||||
ORDER BY country_code, pc""")
|
ORDER BY country_code, pc""")
|
||||||
|
|||||||
@@ -104,6 +104,15 @@ def test_import_postcodes_remove(dsn, placex_table, postcode_table, tmp_path, to
|
|||||||
assert postcode_table.row_set == {('xx', 'AB 4511', 10, 12)}
|
assert postcode_table.row_set == {('xx', 'AB 4511', 10, 12)}
|
||||||
|
|
||||||
|
|
||||||
|
def test_import_postcodes_ignore_empty_country(dsn, placex_table, postcode_table, tmp_path, tokenizer):
|
||||||
|
placex_table.add(country=None, geom='POINT(10 12)',
|
||||||
|
address=dict(postcode='AB 4511'))
|
||||||
|
|
||||||
|
postcodes.update_postcodes(dsn, tmp_path, tokenizer)
|
||||||
|
|
||||||
|
assert not postcode_table.row_set
|
||||||
|
|
||||||
|
|
||||||
def test_import_postcodes_remove_all(dsn, placex_table, postcode_table, tmp_path, tokenizer):
|
def test_import_postcodes_remove_all(dsn, placex_table, postcode_table, tmp_path, tokenizer):
|
||||||
postcode_table.add('ch', '5613', 10, 12)
|
postcode_table.add('ch', '5613', 10, 12)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user