Show more specific boundary type in search results

This commit is contained in:
Sarah Hoffmann 2013-06-23 22:46:26 +02:00 committed by Tom Hughes
parent bbd7a46c8b
commit 378869b77d
2 changed files with 12 additions and 0 deletions

View file

@ -174,6 +174,10 @@ class GeocoderController < ApplicationController
name = place.attributes["display_name"].to_s name = place.attributes["display_name"].to_s
min_lat,max_lat,min_lon,max_lon = place.attributes["boundingbox"].to_s.split(",") 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 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 prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name
object_type = place.attributes["osm_type"] object_type = place.attributes["osm_type"]
object_id = place.attributes["osm_id"] object_id = place.attributes["osm_id"]

View file

@ -922,6 +922,14 @@ en:
waterfall: "Waterfall" waterfall: "Waterfall"
water_point: "Water Point" water_point: "Water Point"
weir: "Weir" 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: description:
title: title:
osm_nominatim: 'Location from <a href="http://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>' osm_nominatim: 'Location from <a href="http://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>'