From 6730c8bac892eae7fa85152add219b7717ca86a2 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 16 Feb 2025 10:16:40 +0100 Subject: [PATCH 1/2] add optional output of extratags to geocodejson --- src/nominatim_api/v1/format_json.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nominatim_api/v1/format_json.py b/src/nominatim_api/v1/format_json.py index b397e702..00c953da 100644 --- a/src/nominatim_api/v1/format_json.py +++ b/src/nominatim_api/v1/format_json.py @@ -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') From f143ecaf1c7fc39f67c4d0baf7deea38ce2914f7 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 17 Feb 2025 10:04:23 +0100 Subject: [PATCH 2/2] add documentation for new extra field --- docs/api/Output.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/api/Output.md b/docs/api/Output.md index 75220cf5..a5ec933e 100644 --- a/docs/api/Output.md +++ b/docs/api/Output.md @@ -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.