From d33f0c848e3562554ccc89ccda7a1a3a9b4e76d2 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Wed, 22 Aug 2012 17:51:21 -0400
Subject: [PATCH] Improve #street and #city for Nominatim result.

---
 lib/geocoder/results/nominatim.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/geocoder/results/nominatim.rb b/lib/geocoder/results/nominatim.rb
index 395115d3..561d3c84 100644
--- a/lib/geocoder/results/nominatim.rb
+++ b/lib/geocoder/results/nominatim.rb
@@ -18,11 +18,17 @@ module Geocoder::Result
     end
 
     def street
-      @data['address']['road']
+      %w[road pedestrian highway].each do |key|
+        return @data['address'][key] if @data['address'].key?(key)
+      end
+      return nil
     end
 
     def city
-      @data['address']['city']
+      %w[city town village hamlet].each do |key|
+        return @data['address'][key] if @data['address'].key?(key)
+      end
+      return nil
     end
 
     def village
-- 
GitLab