From e58bdc66d84f85e58af78d5d75daa8b9bdd815b8 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 20 Apr 2026 14:21:34 +0200 Subject: [PATCH] use admin_level from extratags when classifying Nominatim search results --- app/controllers/searches/nominatim_queries_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/searches/nominatim_queries_controller.rb b/app/controllers/searches/nominatim_queries_controller.rb index ad8bcd8a1..725b55f0e 100644 --- a/app/controllers/searches/nominatim_queries_controller.rb +++ b/app/controllers/searches/nominatim_queries_controller.rb @@ -33,16 +33,16 @@ module Searches t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.tr("_", " ").capitalize end if klass == "boundary" && type == "administrative" - rank = (place.attributes["address_rank"].to_i + 1) / 2 - prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name border_type = nil place_type = nil + admin_type = nil place_tags = %w[linked_place place] place.elements["extratags"].elements.each("tag") do |extratag| border_type = t "geocoder.search_osm_nominatim.border_types.#{extratag.attributes['value']}", :default => border_type if extratag.attributes["key"] == "border_type" place_type = t "geocoder.search_osm_nominatim.prefix.place.#{extratag.attributes['value']}", :default => place_type if place_tags.include?(extratag.attributes["key"]) + admin_type = t "geocoder.search_osm_nominatim.admin_levels.level#{extratag.attributes['value']}", :default => admin_type if extratag.attributes["key"] == "admin_level" end - prefix_name = place_type || border_type || prefix_name + prefix_name = place_type || border_type || admin_type || prefix_name end prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name object_type = place.attributes["osm_type"] -- 2.39.5