diff --git a/lib/geokit/geocoders/openstreetmap.rb b/lib/geokit/geocoders/openstreetmap.rb index c8624d95..dbf2ee61 100644 --- a/lib/geokit/geocoders/openstreetmap.rb +++ b/lib/geokit/geocoders/openstreetmap.rb @@ -84,6 +84,7 @@ def self.set_address_components(address_data, loc) loc.country = address_data['country'] loc.country_code = address_data['country_code'].upcase if address_data['country_code'] loc.state_name = address_data['state'] + loc.county = address_data['county'] loc.city = address_data['city'] loc.city = address_data['county'] if loc.city.nil? && address_data['county'] loc.zip = address_data['postcode'] diff --git a/test/test_openstreetmap_geocoder.rb b/test/test_openstreetmap_geocoder.rb index f3336ebb..028d8b9c 100644 --- a/test/test_openstreetmap_geocoder.rb +++ b/test/test_openstreetmap_geocoder.rb @@ -103,6 +103,7 @@ def test_reverse_geo_coding assert_equal 'osm', res.provider assert_equal 'Prilep', res.city + assert_equal nil, res.county assert_nil res.state assert_equal 'Macedonia', res.country @@ -127,6 +128,7 @@ def test_reverse_geo_code assert_equal 'osm', res.provider assert_equal 'Madrid', res.city + assert_equal 'Madrid', res.county assert_equal 'Madrid', res.state assert_equal 'Spain', res.country