Skip to content

Commit

Permalink
Implement county for OpenStreetMap
Browse files Browse the repository at this point in the history
  • Loading branch information
dsantosmerino committed Jan 22, 2020
1 parent 5612dca commit 64dae75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/geokit/geocoders/openstreetmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 2 additions & 0 deletions test/test_openstreetmap_geocoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 64dae75

Please sign in to comment.