Skip to content

Commit

Permalink
Merge pull request #3384 from mtmail/geocodejson-admin-levels-only-bo…
Browse files Browse the repository at this point in the history
…undaries

geocodejson: admin level output should only print boundaries
  • Loading branch information
lonvia authored Apr 3, 2024
2 parents 657aae5 + 05eb1d5 commit 5c4c98d
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 5c4c98d

Please sign in to comment.