when creating, won't accept city-level accuracy
meeotch - March 12, 2008 - 03:35
| Project: | Google Client Geocoder |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | xmarket |
| Status: | active |
Jump to:
Description
I've added gcg processing to a content type on my site, and set "required accuracy" to "town/city level". However, when trying to create content of this type, I get the error:
"You should provide a more accure address. Required level is Post code (zip code) level"
Also, when typing in a zip code to the address field and hitting "search", gcg doesn't seem to properly file the zip code into the "postal code" box.
My application: I'd like users to be able to input either a city,country or zipcode or city,state, and have gcg silently store lat/lon info to their profile.

#1
This can be a geocoder bug.
Uncomment:
in _gcg_expand() in gcg.module at line 247.
in Gcg.extractResponse() in gcg.js at line 120.
If you refresh the node form, you will see a textarea, which will contain the plain result string of the last search.
If the string contains the zip code, but the field is not, please report it.
#2
So I uncommented the debug code you specified. The results are: no values in any of the fields, except for "Accuracy" and "Country" (which shows "Unknown Country". The debug text area is also blank.
If you'd like to test it, I have a fresh drupal 5.7 installation, no other added modules besides gcg, no changes except the two debug lines here: www.asinineproductions.com I've enabled Create Content for a "GcgTest" node type, which has its gcg settings at the default.
Edit: it turns out my copy of gcg had "-result-result" in the debug code. (You might want to check this.) I corrected this, and now the debug text area works. When searching on "10018", I get the behavior I described above: the "Postal Code" field is empty, and the form will not submit (I've got "address required" checked in the config). The contents of the debug text area are:
({id:"p1", address:"New York, NY 10018, USA", AddressDetails:{Country:{CountryNameCode:"US", AdministrativeArea:{AdministrativeAreaName:"NY", Locality:{LocalityName:"New York", PostalCode:{PostalCodeNumber:"10018"}}}}, Accuracy:5}, Point:{coordinates:[-73.996684, 40.755256, 0]}})So it's finding the zip code correctly, it just isn't putting it in the field properly, in the case of a zip-code-only search.
#3
Edited to fix the issue title.