Skip to content

Commit

Permalink
geocodejson: admin level output should only print boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail committed Apr 2, 2024
1 parent 78c19bc commit 05eb1d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nominatim/api/v1/format_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ def format_base_geocodejson(results: Union[napi.ReverseResults, napi.SearchResul
out.key('admin').start_object()
if result.address_rows:
for line in result.address_rows:
if line.isaddress and (line.admin_level or 15) < 15 and line.local_name:
if line.isaddress and (line.admin_level or 15) < 15 and line.local_name \
and line.category[0] == 'boundary' and line.category[1] == 'administrative':
out.keyval(f"level{line.admin_level}", line.local_name)
out.end_object().next()

Expand Down

0 comments on commit 05eb1d5

Please sign in to comment.