def get_district_distant_matches(self, distant_matches_view='distant_matches',
district_id=182):
"""Get OSM entities that are matched to an FHRS establishment where
the OSM/FHRS locations are distant.
distant_matches_view (string): name of distant matches database view
district_id (integer): Boundary Line district ID
Returns dict
"""
dict_cur = self.connection.cursor(cursor_factory=DictCursor)
sql = ('SELECT osm_id, osm_type,\n' +
'CONCAT(SUBSTRING(osm_type FROM 1 FOR 1), osm_id) AS osm_ident, fhrs_id,\n' +
'osm_name, fhrs_name, distance\n' +
'FROM ' + distant_matches_view + '\n' +
'WHERE district_id = %s' +
'ORDER BY distance;')
values = (district_id,)
dict_cur.execute(sql, values)
result = []
for row in dict_cur.fetchall():
result.append(row)
return result
评论列表
文章目录