mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-09 19:44:07 +00:00
switch reverse CLI command to Python implementation
This commit is contained in:
@@ -30,8 +30,15 @@ def _select_from_placex(t: SaFromClause, wkt: Optional[str] = None) -> SaSelect:
|
||||
"""
|
||||
if wkt is None:
|
||||
distance = t.c.distance
|
||||
centroid = t.c.centroid
|
||||
else:
|
||||
distance = t.c.geometry.ST_Distance(wkt)
|
||||
centroid = sa.case(
|
||||
(t.c.geometry.ST_GeometryType().in_(('ST_LineString',
|
||||
'ST_MultiLineString')),
|
||||
t.c.geometry.ST_ClosestPoint(wkt)),
|
||||
else_=t.c.centroid).label('centroid')
|
||||
|
||||
|
||||
return sa.select(t.c.place_id, t.c.osm_type, t.c.osm_id, t.c.name,
|
||||
t.c.class_, t.c.type,
|
||||
@@ -39,11 +46,7 @@ def _select_from_placex(t: SaFromClause, wkt: Optional[str] = None) -> SaSelect:
|
||||
t.c.housenumber, t.c.postcode, t.c.country_code,
|
||||
t.c.importance, t.c.wikipedia,
|
||||
t.c.parent_place_id, t.c.rank_address, t.c.rank_search,
|
||||
sa.case(
|
||||
(t.c.geometry.ST_GeometryType().in_(('ST_LineString',
|
||||
'ST_MultiLineString')),
|
||||
t.c.geometry.ST_ClosestPoint(wkt)),
|
||||
else_=t.c.centroid).label('centroid'),
|
||||
centroid,
|
||||
distance.label('distance'),
|
||||
t.c.geometry.ST_Expand(0).label('bbox'))
|
||||
|
||||
|
||||
@@ -325,8 +325,7 @@ async def reverse_endpoint(api: napi.NominatimAPIAsync, params: ASGIAdaptor) ->
|
||||
fmt_options = {'locales': locales,
|
||||
'extratags': params.get_bool('extratags', False),
|
||||
'namedetails': params.get_bool('namedetails', False),
|
||||
'addressdetails': params.get_bool('addressdetails', True),
|
||||
'single_result': True}
|
||||
'addressdetails': params.get_bool('addressdetails', True)}
|
||||
if fmt == 'xml':
|
||||
fmt_options['xml_roottag'] = 'reversegeocode'
|
||||
fmt_options['xml_extra_info'] = {'querystring': 'TODO'}
|
||||
|
||||
Reference in New Issue
Block a user