lib/geokit/geocoders/opencage.rb in geokit-1.13.1 vs lib/geokit/geocoders/opencage.rb in geokit-1.14.0
- old
+ new
@@ -72,14 +72,18 @@
def self.set_address_components(address_data, loc)
return unless address_data
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['town'] if loc.city.nil? && address_data['town']
loc.city = address_data['county'] if loc.city.nil? && address_data['county']
loc.zip = address_data['postcode']
loc.district = address_data['city_district']
loc.district = address_data['state_district'] if loc.district.nil? && address_data['state_district']
+ loc.neighborhood = address_data['neighbourhood']
+ loc.neighborhood = address_data['suburb'] if loc.neighborhood.nil?
loc.street_address = "#{address_data['road']} #{address_data['house_number']}".strip if address_data['road']
loc.street_name = address_data['road']
loc.street_number = address_data['house_number']
end