1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2023 by the Nominatim developer community.
6 # For a full list of authors see the git log.
8 Constants shared by all formats.
11 import nominatim.api as napi
13 # pylint: disable=line-too-long
14 OSM_ATTRIBUTION = 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'
22 NODE_EXTENT = [25, 25, 25, 25,
24 2.6, 2.6, 2.0, 1.0, 1.0,
26 0.16, 0.16, 0.16, 0.16,
29 0.01, 0.01, 0.01, 0.01, 0.01,
30 0.015, 0.015, 0.015, 0.015,
34 def bbox_from_result(result: napi.ReverseResult) -> napi.Bbox:
35 """ Compute a bounding box for the result. For ways and relations
36 a given boundingbox is used. For all other object, a box is computed
37 around the centroid according to dimensions dereived from the
40 if (result.osm_object and result.osm_object[0] == 'N') or result.bbox is None:
41 return napi.Bbox.from_point(result.centroid, NODE_EXTENT[result.rank_search])