I'm using the Google geocoder widget to Address field mapping that was added in #2681335: Dump address result from geocoder widget in address field. I've found a bug with the handling of addresses in Spain. Google stores the Spanish province name in administrative_area_level_2, whereas Geolocation's default handling is to map administrative_area_level_1 to the province field.

Comments

Peacog created an issue. See original summary.

peacog’s picture

Status: Active » Needs review
StatusFileSize
new1.14 KB

Here's a patch that adds country-specific handling of administrative area for Spain.

adarkling’s picture

Maybe this should be broken out into a separate function, because there're some other countries that would have similar problems.

rakesh.nimje84@gmail.com’s picture

I am also facing this problem in case of country is India.

christianadamski’s picture

The underlying issue is, there is no public documentation to be found, that maps the single address elements, to the components.

Example:
- In the US, the 'address line 1' would be filled as "[house number] [street name]". In Germany the correct format is "[street name] [house number]"

The address module takes address structure data from a Google github project, which for example provides data on whether administrative area is a required component for a postal address in a country. But not the detailed address element <-> component mapping as described above. There simply is no public source for that. Or at least I didn't find any.

So to tackle this, we will have to provide a custom AddressMappingService and add requirements as they come to it. I will write something up, but it may take a little longer.

marassa’s picture

Example:
- In the US, the 'address line 1' would be filled as "[house number] [street name]". In Germany the correct format is "[street name] [house number]"

I did a little research for my project and found that the "number first" format is used in major English speaking countries (US, UK, Canada, Australia, NZ, Ireland) plus France while the "number last" is used in most of the rest of the world. But I did not research Asia, Africa and various island states as those were not relevant to my project. Anyways, at least for my project spanning dozens of countries in Europe (including Russia and post-Soviet space) and both Americas, it seemed a better idea to make the "number last" format the default and maintain a relatively short list of countries using "number first".

christianadamski’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Component: Google Maps geolocation » Geolocation Field / Backend
Status: Needs review » Postponed
Parent issue: » #2958056: geolocation_address is broken

Will be fixed in 2.x

christianadamski’s picture

Status: Postponed » Fixed

You can simply write GeocoderCountryFormatting plugins in 2.x for this specific requirement. I added one for Spain. Go ahead and test please.

Considering this fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.