]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #3648 from lonvia/extratags-for-geocodejson
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 17 Feb 2025 10:14:52 +0000 (11:14 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Feb 2025 10:14:52 +0000 (11:14 +0100)
Enable output of extratags for geocodejson format

docs/api/Output.md
src/nominatim_api/v1/format_json.py

index 75220cf510b1595abbaccd084ab388a0304b813f..a5ec933e0fdabb172c9a198e994bed890aab3f88 100644 (file)
@@ -106,8 +106,11 @@ The following feature attributes are implemented:
  * `name` - localised name of the place
  * `housenumber`, `street`, `locality`, `district`, `postcode`, `city`,
    `county`, `state`, `country` -
-   provided when it can be determined from the address
+   provided when it can be determined from the address (only with `addressdetails=1`)
  * `admin` - list of localised names of administrative boundaries (only with `addressdetails=1`)
+ * `extra` - dictionary with additional useful tags like `website` or `maxspeed`
+   (only with `extratags=1`)
+
 
 Use `polygon_geojson` to output the full geometry of the object instead
 of the centroid.
index b397e702cec09ec5a791762dba0fdd4422ec918e..00c953da644f087b662126a360dae0e5f6f5320f 100644 (file)
@@ -249,6 +249,9 @@ def format_base_geocodejson(results: Union[ReverseResults, SearchResults],
                         out.keyval(f"level{line.admin_level}", line.local_name)
             out.end_object().next()
 
+        if options.get('extratags', False):
+            out.keyval('extra', result.extratags)
+
         out.end_object().next().end_object().next()
 
         out.key('geometry').raw(result.geometry.get('geojson')