]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/clicmd/api.py
switch API parameters to keyword arguments
[nominatim.git] / nominatim / clicmd / api.py
index 58edbea4b8776d7b5705ea1e123344a57d8b80bf..c4120599167479a6d9099b480d2ff05e38504b8a 100644 (file)
@@ -163,14 +163,12 @@ class APIReverse:
     def run(self, args: NominatimArgs) -> int:
         api = napi.NominatimAPI(args.project_dir)
 
-        details = napi.LookupDetails(address_details=True, # needed for display name
-                                     geometry_output=args.get_geometry_output(),
-                                     geometry_simplification=args.polygon_threshold or 0.0)
-
         result = api.reverse(napi.Point(args.lon, args.lat),
-                             REVERSE_MAX_RANKS[max(0, min(18, args.zoom or 18))],
-                             args.get_layers(napi.DataLayer.ADDRESS | napi.DataLayer.POI),
-                             details)
+                             max_rank=REVERSE_MAX_RANKS[max(0, min(18, args.zoom or 18))],
+                             layers=args.get_layers(napi.DataLayer.ADDRESS | napi.DataLayer.POI),
+                             address_details=True, # needed for display name
+                             geometry_output=args.get_geometry_output(),
+                             geometry_simplification=args.polygon_threshold)
 
         if result:
             output = api_output.format_result(
@@ -216,13 +214,12 @@ class APILookup:
     def run(self, args: NominatimArgs) -> int:
         api = napi.NominatimAPI(args.project_dir)
 
-        details = napi.LookupDetails(address_details=True, # needed for display name
-                                     geometry_output=args.get_geometry_output(),
-                                     geometry_simplification=args.polygon_threshold or 0.0)
-
         places = [napi.OsmID(o[0], int(o[1:])) for o in args.ids]
 
-        results = api.lookup(places, details)
+        results = api.lookup(places,
+                             address_details=True, # needed for display name
+                             geometry_output=args.get_geometry_output(),
+                             geometry_simplification=args.polygon_threshold or 0.0)
 
         output = api_output.format_result(
                     results,
@@ -297,14 +294,15 @@ class APIDetails:
 
         api = napi.NominatimAPI(args.project_dir)
 
-        details = napi.LookupDetails(address_details=args.addressdetails,
-                                     linked_places=args.linkedplaces,
-                                     parented_places=args.hierarchy,
-                                     keywords=args.keywords)
-        if args.polygon_geojson:
-            details.geometry_output = napi.GeometryFormat.GEOJSON
+        result = api.details(place,
+                             address_details=args.addressdetails,
+                             linked_places=args.linkedplaces,
+                             parented_places=args.hierarchy,
+                             keywords=args.keywords,
+                             geometry_output=napi.GeometryFormat.GEOJSON
+                                             if args.polygon_geojson
+                                             else napi.GeometryFormat.NONE)
 
-        result = api.details(place, details)
 
         if result:
             output = api_output.format_result(