Add viewbox-bounded search and enable Dutch quick-search chips

- Pass the currently visible map bounds as a Nominatim viewbox so
  results are restricted to what the user can see (bounded=1).
- Increase default result limit from 8 to 20.
- Enable the quick-search chip row with localized Dutch labels
  (Supermarkt, Café, Kroeg, Camping, Park, Restaurant, Vegan,
  Hotel, Parkeerplek).
This commit is contained in:
2026-08-21 14:10:30 +02:00
parent 51f2eb8e1d
commit 439d389a44
2 changed files with 72 additions and 16 deletions

23
app.py
View File

@@ -60,13 +60,34 @@ def search():
params = {
"q": query,
"format": "jsonv2",
"limit": 8,
"limit": 20,
"addressdetails": 1,
"extratags": 1,
"namedetails": 1,
"dedupe": 1,
}
# Restrict results to the area currently visible on the map.
# Expected format: "left,top,right,bottom" (lon,lat pairs).
viewbox = request.args.get("viewbox", "").strip()
if viewbox:
parts = [p.strip() for p in viewbox.split(",")]
if len(parts) == 4:
try:
left, top, right, bottom = (
float(p) for p in parts
)
params["viewbox"] = "{},{},{},{}".format(
left, top, right, bottom
)
params["bounded"] = 1
except ValueError:
pass
try:
results = nominatim_request(
NOMINATIM_SEARCH_URL,