If a user adds a location using the coordinate fields (perhaps by clicking on the map in gmap_location), they will not necessarily also be adding any of the address fields in. I think it would be very useful if, once a user had entered coordinates, the module looked up those coordinates using the geocoding API and offered to enter some combination of the returned structured data into the address for them.
Depending on the precision of their location, they may want to enter just country, or city and country, or perhaps (though less likely) more granular information, if it's available.
I envisage this could be done as an AJAX request clientside, or perhaps just do it on node save, as the address -> coordinates lookup does. The difference is, reverse geocoding is less likely to be accurate as we don't necessarily know the level of detail to which they've specified it.
Comments
Comment #1
summit commented+1 for this! very much interested!
Edit: Did I put this to test..sorry not intended.
greetings,
Martijn
Comment #2
geodaniel commentedComment #3
danielnolde commentedI'd also suggest for normal forward-geocoding to use the data provided by the external geocoding service for filling up missing user input. E.g.: If i type in just "Dallas" as city and leave other fields like postal code empty. The location record will only have the field "city" set, but since this input will be geocoded just fine, why not using the returned address details like zipcode, state etc. to fill the missing fields in the location record?!
@Brandon: I'd code this if you think the idea's good ... should be quite easy.
Comment #4
summit commentedWould be great to have this in!
Greetings,
Martijn
Comment #5
geodaniel commentedAt times it could be good to have the rest of the address populated, but there may also be occasions where the user really just wanted the city in there (e.g. they didn't know exactly where in the city this thing was located), so automatically filling in missing fields would be misleading. However, it would be nice to give users the option of filling in empty fields with the data that comes back from the geocoder, so they can use it if they wish.
Comment #6
danielnolde commentedexactly, this would have to be optionally.
However, nothing comes back from the geocoder more exact that was put in in the first place, so if e.g no street was input intentionally, the geocoder wouldn't return that information, but it would be of use (e.g. in overviews, postal_code-searches etc.) to have the "default" zipcode written back (the many smaller cities have just one, anyway) or have the unambigous state-information added.
The option to do it this way should be given to the user, of course.
Comment #7
summit commentedHi,
Added to above it would be great to have some functions like the _iso functions to be able to get the region from the city and country. Or get the country from the city and region, or get the country from the city only. Not only through user-input, but also automated from the information at hand.
So first maybe if possible:
1a- The country from the lat/lon
1b- The region from the lat/lon
1c- The city from the lat/lon
Then may be:
2a- The region from the country and city
2b- The country from the region and city
2c- The country from the region
2d- The country from the city.
This way with only small information available by the user, or from something like for example a feed the whole location table can be filled with the correct values. And if there is one or two mistakes then user-correction can change these values correct.
Hopefully this input is valuable to this thread.
Greetings,
Martijn
Comment #8
trogie commentedsubscribing
Comment #9
bcn commentedI thought this used to work in the 5.x version of location, but doesn't seem to in 6.x... That is, I had a setup where users entered country and post code, and then I was able to display city, state/province, etc...
Anyway, subscribe!
Comment #10
yesct commentedI marked #327025: reverse lookup and taxonomy as a bit of a duplicate of this issue.
tagging super cool idea
Comment #11
DanielJohnston commentedSubscribing. Geocoding to UK counties or regions is my bag.
Comment #12
furrymitn commentedFunny - i just did this today, out of necessity.
There is no user-interaction, it just overwrites what the user input with the geocoded info, and it changes the way that the geocoding is done(uses JSON from google, instead of XML), but I plan on going further with it at some point.
http://drupal.org/node/495690
Comment #13
EvanDonovan commentedgeodaniel, summit, et al.:
Check out my latest patch on #495690: Change user-inputted address (or lat/lon) to geocoded address info & see whether it satisfies what you are looking for. It builds off furrymitn's work to make it so the user input data is only overwritten when the latitude & longitude are changed.
If the patch does satisfy what you are looking for, I think it might be better for me to re-roll it as a single patch (currently it needs some help - I'm not the best at rolling patches). I might also add an option in the admin, since currently it always does reverse geocoding if the latitude & longitude are changed.
Once re-rolled, I would bring the new version of it over to this issue & we could continue the discussion here. furrymitn's issue seems to be satisfying a slightly different use case (i.e., always overwriting user-submitted data with Google's data, not just when latitude/longitude are changed). But I'm waiting to hear back on whether I am correct about that.
Comment #14
summit commentedHi, I am not at home right now. Geodaniel please take the lead, thanks!
Greetings,
Martijn
Comment #15
m@rtijn commentedSubscribing! I think this reverse geocoding functionality could be very useful.
Comment #16
henno.gous commentedhas this been committed to dev yet?
Comment #17
EvanDonovan commentedI don't think that's even on the radar. The functionality is in the linked issues, not this one.
Comment #18
robotjox commentedHi, I managed to integrate the patch at #6 with success - the only thing I'm missing is the automatic fill-in of the address fields on map-click - anyone know if this is possible?
Comment #19
hlopes commentedEvan:
shouldn't this thread (and the others you've mentioned) be the ones marked as duplicate of #190578 Reverse Geocoding ?
I'm just asking because the other thread is older than the ones you've mentioned.
Anyway, there's a stand alone module that does this task here. Still under development.
Comment #20
EvanDonovan commented@HLopes: The issue you mention is for the Gmap module, is on the 5.x branch, and has no working patch. My argument is that this kind of functionality should be in Location module in any case, since it is not Gmap-specific.
I'll have to check out the module you linked. Are there plans to eventually add it to Drupal.org?
Comment #21
legolasboClosing old D6 issues as D6 is end of life