Problem/Motivation

When geocoding addresses from geoJson, the address administrative area is admin level 2 for Spain, not admin level 1. It would be good to be able to alter this like we can for countries.

Steps to reproduce

1. Download and install the Geocoder module
2. Add a text field to a content type
3. Add an address field to a content type
4. Set the address field to geocode from the text field
5. Put a Spanish address in the text field
6. See that the province select is left empty, which causes validation errors as it is a select, regardless of any "optional" overrides

Proposed resolution

Allow other modules to hook into an override the administrative area.

Remaining tasks

Add the hook, API documentation and tests.

User interface changes

None

API changes

New hook: hook_geocode_administrative_area_alter

Data model changes

None

Issue fork geocoder-3555241

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

littlepixiez created an issue. See original summary.

littlepixiez’s picture

Assigned: littlepixiez » Unassigned
Status: Active » Needs work

I've proposed a solution of adding a patch here, so you can use the geojson and change the administrative area. It may be that in the future we add a hook for all of the values potentially? I need to add tests for this, but will unassign myself in-case somebody else gets here first. Fingers crossed the community see a need for it - I've seen a couple of comments about the administrative area and Spanish addresses etc not being correct.

itamair’s picture

is this MR !75 still a WIP (Needs Work)? or should we move this into Needs Review?