]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/api/v1/helpers.py
use string representation when dumping variables
[nominatim.git] / nominatim / api / v1 / helpers.py
index b9259ff291660f9b7ba1b4716e3fd6be6f975038..62e5e943441c1b526994a78d7f6bfd0557723ea8 100644 (file)
@@ -52,7 +52,7 @@ def feature_type_to_rank(feature_type: Optional[str]) -> Tuple[int, int]:
     return FEATURE_TYPE_TO_RANK.get(feature_type, (0, 30))
 
 
-#pylint: disable=too-many-arguments
+#pylint: disable=too-many-arguments,too-many-branches
 def extend_query_parts(queryparts: Dict[str, Any], details: Dict[str, Any],
                        feature_type: Optional[str],
                        namedetails: bool, extratags: bool,
@@ -62,9 +62,14 @@ def extend_query_parts(queryparts: Dict[str, Any], details: Dict[str, Any],
     """
     parsed = SearchDetails.from_kwargs(details)
     if parsed.geometry_output != GeometryFormat.NONE:
-        for flag in parsed.geometry_output:
-            assert flag.name
-            queryparts[f'polygon_{flag.name.lower()}'] = '1'
+        if parsed.geometry_output & GeometryFormat.GEOJSON:
+            queryparts['polygon_geojson'] = '1'
+        if parsed.geometry_output & GeometryFormat.KML:
+            queryparts['polygon_kml'] = '1'
+        if parsed.geometry_output & GeometryFormat.SVG:
+            queryparts['polygon_svg'] = '1'
+        if parsed.geometry_output & GeometryFormat.TEXT:
+            queryparts['polygon_text'] = '1'
     if parsed.address_details:
         queryparts['addressdetails'] = '1'
     if namedetails: