]> git.openstreetmap.org Git - rails.git/commitdiff
Handle an empty type value in a nominatim result
authorTom Hughes <tom@compton.nu>
Mon, 21 Oct 2013 15:54:56 +0000 (17:54 +0200)
committerTom Hughes <tom@compton.nu>
Mon, 21 Oct 2013 17:56:56 +0000 (18:56 +0100)
app/controllers/geocoder_controller.rb

index 34d8efdbcfefa9961d62489fb75fd692a735bb13..6db70a6f37fc3ca21dbf72d8de37e1401e34403d 100644 (file)
@@ -160,7 +160,11 @@ class GeocoderController < ApplicationController
       type = place.attributes["type"].to_s
       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 type.empty?
+        prefix_name = ""
+      else
+        prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize
+      end
       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