]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix regression with lat/lon in json output
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Aug 2023 10:21:11 +0000 (12:21 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 1 Aug 2023 12:27:43 +0000 (14:27 +0200)
lat, lon is returned as strings in the PHP output. Reproduce that in the
Python frontend.

See #3115.

nominatim/api/v1/format_json.py

index 99a3f182cb2a6b72cd76fe1e3b5d383457476183..80560c95278da93f5175dbe5e0ceb232abeb6d51 100644 (file)
@@ -86,8 +86,8 @@ def format_base_json(results: Union[napi.ReverseResults, napi.SearchResults],
 
         _write_osm_id(out, result.osm_object)
 
-        out.keyval('lat', result.centroid.lat)\
-             .keyval('lon', result.centroid.lon)\
+        out.keyval('lat', f"{result.centroid.lat}")\
+             .keyval('lon', f"{result.centroid.lon}")\
              .keyval(class_label, result.category[0])\
              .keyval('type', result.category[1])\
              .keyval('place_rank', result.rank_search)\