Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
For a client's website we have been using the addressfield module as a source for geocoder to request location data, and I've run into a situation where geocoder was constantly requesting location data by an empty address string, thus returning status ZERO_RESULTS.
To solve this issue I've created a small patch to do an additional check to see if the addressfield is considered empty, using addressfield's addressfield_field_is_empty() function.
Comment | File | Size | Author |
---|---|---|---|
#1 | geocoder-dont_geocode_addressfield_if_empty-2114183-1.patch | 3.99 KB | jorisdejong |
Comments
Comment #1
jorisdejong CreditAttribution: jorisdejong commentedPatch here.
I've done this for all handlers supporting addressfield.
Comment #2
janis_lv CreditAttribution: janis_lv commentedThis is cool,
I've run into a situation where I've deleted addresses from address field but Geocoder still shows old wkt point :)
Comment #3
Simon Georges CreditAttribution: Simon Georges commentedChanging status, as there is a patch.
Comment #4
Simon Georges CreditAttribution: Simon Georges commentedCommitted, thanks!
Comment #7
nirad CreditAttribution: nirad commentedI have Address Field set to use only one country (the United States), so the Geocoder always gets populated because this field is filled out by default. The only way I found around this is to add other countries and make the default country "-None-", though this isn't ideal. Is there a way I can limit the Address Field to one country without populating the Geocoder?