Class: AtlasEngine::Us::AddressImporter::OpenAddress::Mapper
- Inherits:
-
AddressImporter::OpenAddress::DefaultMapper
- Object
- AddressImporter::OpenAddress::DefaultMapper
- AtlasEngine::Us::AddressImporter::OpenAddress::Mapper
- Defined in:
- app/countries/atlas_engine/us/address_importer/open_address/mapper.rb
Constant Summary collapse
- ORDINAL_REGEX =
/\b(\d+)(?:\s+)(st|nd|rd|th)\b/i
Instance Method Summary collapse
Methods inherited from AddressImporter::OpenAddress::DefaultMapper
Methods included from AddressImporter::OpenAddress::FeatureHelper
#geometry, #housenumber_and_unit, #normalize_zip, #openaddress_source_id, #province_code_from_name, #province_code_from_zip, #province_from_code
Constructor Details
This class inherits a constructor from AtlasEngine::AddressImporter::OpenAddress::DefaultMapper
Instance Method Details
#map(feature) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/countries/atlas_engine/us/address_importer/open_address/mapper.rb', line 14 def map(feature) city, street, number, unit, postcode = feature["properties"].values_at( "city", "street", "number", "unit", "postcode", ) { source_id: openaddress_source_id(feature), locale: @locale, country_code: @country_code, province_code: @province_code, # region is inconsistently set, override with passed in province_code # Omitted: region1..4 city: sanitize_city(city), suburb: nil, zip: postcode.first(5), # truncate zip+4 data street: sanitize_street(street), building_and_unit_ranges: housenumber_and_unit(number, unit), latitude: geometry(feature)&.at(1), longitude: geometry(feature)&.at(0), } end |