X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/bb43a46babaf2f2853cf33567380b085c02aea9e..4ac48d2cb5cd2197d8f2702bdc7b17072b2fdc85:/app/controllers/geocoder_controller.rb diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 1b9ca05b5..69c35e0e3 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -93,19 +93,23 @@ private type = named.attributes["info"].to_s.capitalize name = named.attributes["name"].to_s description = named.elements["description"].to_s + if name.empty? + prefix = "" + name = type + else + prefix = "#{type} " + end if place distance = format_distance(place.attributes["approxdistance"].to_i) direction = format_direction(place.attributes["direction"].to_i) placename = place.attributes["name"].to_s - results.push({:lat => lat, :lon => lon, :zoom => zoom, - :prefix => "#{type} ", :name => name, - :suffix => ", #{distance} #{direction} of #{placename}", - :description => description}) + suffix = ", #{distance} #{direction} of #{placename}" else - results.push({:lat => lat, :lon => lon, :zoom => zoom, - :prefix => "#{type} ", :name => name, - :description => description}) + suffix = "" end + results.push({:lat => lat, :lon => lon, :zoom => zoom, + :prefix => prefix, :name => name, :suffix => suffix, + :description => description}) end return { :source => "OpenStreetMap Namefinder", :url => "http://www.frankieandshadow.com/osm/", :results => results }