]> git.openstreetmap.org Git - rails.git/commitdiff
Show more specific boundary type in search results
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 23 Jun 2013 20:46:26 +0000 (22:46 +0200)
committerTom Hughes <tom@compton.nu>
Mon, 24 Jun 2013 21:26:28 +0000 (22:26 +0100)
app/controllers/geocoder_controller.rb
config/locales/en.yml

index 47befda382709b808a2e908acef955dfdface599..8f02ce51d2b1a3739804277fc130deab25f61644 100644 (file)
@@ -174,6 +174,10 @@ class GeocoderController < ApplicationController
       name = place.attributes["display_name"].to_s
       min_lat,max_lat,min_lon,max_lon = place.attributes["boundingbox"].to_s.split(",")
       prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize
       name = place.attributes["display_name"].to_s
       min_lat,max_lat,min_lon,max_lon = place.attributes["boundingbox"].to_s.split(",")
       prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize
+      if klass == 'boundary' and type == 'administrative'
+        rank = (place.attributes["place_rank"].to_i + 1) / 2
+        prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name
+      end
       prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name
       object_type = place.attributes["osm_type"]
       object_id = place.attributes["osm_id"]
       prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name
       object_type = place.attributes["osm_type"]
       object_id = place.attributes["osm_id"]
index 0b30e95a9bdf7e27440ee9d271111924938f069c..f9ea7412c6fa37781631487fb4dc7e03a030572b 100644 (file)
@@ -922,6 +922,14 @@ en:
           waterfall: "Waterfall"
           water_point: "Water Point"
           weir: "Weir"
           waterfall: "Waterfall"
           water_point: "Water Point"
           weir: "Weir"
+      admin_levels:
+        level2: "Country Boundary"
+        level4: "State Boundary"
+        level5: "Region Boundary"
+        level6: "County Boundary"
+        level8: "City Boundary"
+        level9: "Village Boundary"
+        level10: "Suburb Boundary"
     description:
       title:
         osm_nominatim: 'Location from <a href="http://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>'
     description:
       title:
         osm_nominatim: 'Location from <a href="http://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>'