Do not have postcode node appear in addresses directly

Many of the postcode nodes are actually derived from
incomplete addresses and are as such not even centroids.
Better let them only take part in the address computation
via the postcode table.
This commit is contained in:
Sarah Hoffmann
2018-07-22 16:22:07 +02:00
parent 9bdbbec0c8
commit 48d4ea5542
5 changed files with 89 additions and 19 deletions

View File

@@ -498,6 +498,21 @@ def check_place_addressline(context):
context.db.commit()
@then("place_addressline doesn't contain")
def check_place_addressline_exclude(context):
cur = context.db.cursor(cursor_factory=psycopg2.extras.DictCursor)
for row in context.table:
pid = NominatimID(row['object']).get_place_id(cur)
apid = NominatimID(row['address']).get_place_id(cur)
cur.execute(""" SELECT * FROM place_addressline
WHERE place_id = %s AND address_place_id = %s""",
(pid, apid))
eq_(0, cur.rowcount,
"Row found for place %s and address %s" % (row['object'], row['address']))
context.db.commit()
@then("(?P<oid>\w+) expands to(?P<neg> no)? interpolation")
def check_location_property_osmline(context, oid, neg):
cur = context.db.cursor(cursor_factory=psycopg2.extras.DictCursor)