Hello.
First of all, thank you for this useful module! I am currently using the following modules in D7:
Geofield 7.x-1.0
Geocoder 7.x-1.0
Address Field 7.x-1.x-dev (latest)
When I save an address as:
Address 1: 620 W 42 St
Address 2:
City: New York
State: NY
Zip: 10036
It gets geocoded perfectly. But when I add an apartment:
Address 2: APT 27F
Google doesn't geocode it anymore (I only allow the 2 most accurate accuracy levels from Google's geocoder).
However, when I try Google Maps (the site) or the Geolocation geocoder (http://geolocation.forward-media.de/node/add/geolocation-google-maps) with this string: '620 W 42 St Apt 27F, new york, ny 10036' or simple variations thereof, it seems to geolocate the address just fine.
Seems like something may be amiss in the Geocoder. I am not sure how it submits the address from Address FIeld to Google, but maybe there is a bug with Address 2?
Thanks!
-Daniel
Comments
Comment #1
phayes commentedOne thing we could try is removing the comma that we place between address1 and address2 - although I'm worried that may screw up other geocoders like yahoo or yandex
Comment #2
kerberos commentedCould it be removed just for the Google geocoder?
-Daniel
Comment #3
phayes commentedYes, yes it could...
Comment #4
simon georges commentedChanging version.
Comment #5
sja1 commentedIf you are using addressfield, the string being fed to google is generated by the function geocoder_widget_parse_addressfield which is found in the file geocoder.widget.inc.
The function takes only one argument, $field_item, which contains only data held by address field. The function would have to be modified to take another argument so that the name of the geocoding service being used could also be passed in. Then you could include logic to skip the line that adds Address 2 (premise) to the string:
Line 405:
if (!empty($field_item['premise'])) $address .= $field_item['premise'] . ',';A quick hack for users of addressfield and geocoding with google would be to just comment that line out.
Comment #6
joewhitsittI ran into this problem with one of my projects. Since this appears to only be an issue with Addressfield/Google, I don't think it would make sense to mess with the geocoder.widget.inc code.
Each service has a handler (e.g. plugins/geocoder_handler/google.inc) which could be manipulated before it is passed to geocoder_widget_parse_addressfield().
I suggest, within geocoder_google_field(), unsetting $field_item['premise'] inside the addressfield if statement, with the assumption that no other service/field combination has the same issue.
Comment #7
navalogan commentedhi, i got the same problem but your patch #6 not work!
thanks
Comment #8
joewhitsitt@navalogan, can you tell me more?
Did the patch not apply to your 7.x-1.x-dev branch?
Were you able to successfully geocode an address without the premise (address 2) filled in?
Comment #9
navalogan commentedThanks for your quick reply. I applied the patch on my 7.x-1.x-dev branch but address 2 is not ignored. When I try without "address 2" it works fine.
Thanks
Comment #10
navalogan commentedSorry it's worked for me, I forgot to resave the existing content with the geocoder option "Force re-geocoding"
Thanks
Comment #11
joewhitsittComment #12
polHi,
Is this patch still valid ?
Thanks!
Comment #13
joewhitsittI haven't had much time to dig into it, but I am still relying on this patch for a website.
I am using:
Geocoder - 7.x-1.3+18-dev with patch
Geofield - 7.x-2.3
Addressfield - 7.x-1.2
I have cloned the latest 7.x-1.x-dev and 7.x-2.x-dev on the same website without success.
It looks like 7.x-2.x-dev is still too D8 and is unusable in D7.
7.x-1.x-dev - The configuration page is gone and I am getting geoPHP and Google API errors when saving the node with the addressfield/geofield. So until the rest of this version works, it is hard to test to see if this patch is still needed.
Comment #14
jds1The
premisefield is an issue for Openstreetmap Nominatim as well (hi everyone who has dealt with Googlemapsageddon). Honestly it seems to be a problem for all providers. IMO Address 2 should be a label only. Here is a small patch to remove premise from addressfield geocoding for any of the providers.Comment #15
lwalley commentedRe-roll of patch in comment #6 for Geocoder 7.x-1.7.