Watercouses are also linear features

This commit is contained in:
Edward Betts 2021-10-22 11:31:34 +01:00
parent 2c8ac7259c
commit e8b1b411e5

View file

@ -458,23 +458,33 @@ def api_find_osm_candidates(item_id):
qid=f'Q{item_id}', qid=f'Q{item_id}',
error="item doesn't exist") error="item doesn't exist")
if not item.locations:
return cors_jsonify(success=True,
qid=f'Q{item_id}',
error="item has no coordinates")
label = item.label() label = item.label()
item_is_street = item.is_street() item_is_street = item.is_street()
item_is_watercourse = item.is_watercourse()
if item_is_street: if item_is_street:
max_distance = 2_000 max_distance = 5_000
limit = None limit = None
names = expand_street_name(label) names = expand_street_name([label] + item.get_aliases())
elif item_is_watercourse:
max_distance = 20_000
limit = None
names = {label}
else: else:
max_distance = 400 max_distance = 1_000
limit = 60 limit = 40
names = None names = None
nearby = api.find_osm_candidates(item, nearby = api.find_osm_candidates(item,
limit=limit, limit=limit,
max_distance=max_distance, max_distance=max_distance,
names=names) names=names)
if item_is_street and not nearby: if (item_is_street or item_is_watercourse) and not nearby:
# nearby = [osm for osm in nearby if street_name_match(label, osm)] # nearby = [osm for osm in nearby if street_name_match(label, osm)]
# try again without name filter # try again without name filter