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,
I am new in Drupal and would like to create a feature so that whenever user type sth in the address field, it will geocode instantly and the lag/long information will be filled with the result.
I drill down the code and found that google_geocode_location maybe doing this. However, I have no idea how could I achieve this (call this function or sth). Or is the location module supported this already?
Please help.
Comment | File | Size | Author |
---|---|---|---|
#10 | location_gmap_find_address-7.x-1.1.zip | 3.51 KB | sydneyshan |
#9 | location_gmap_find_address.zip | 3.35 KB | sydneyshan |
Comments
Comment #1
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedsubscribing
Comment #2
YesCT CreditAttribution: YesCT commentedtagging with terms that might describe your idea. Maybe look at some of the issues the tags link to and see if your feature request is a duplicate of any of them. Post back and let us know.
I'm not sure what exactly your idea is. Please reply back and give an example of what the user might see on the form, what they might type, and how the form will respond while they type and after they submit.
This will help move this idea forward.
Comment #3
YesCT CreditAttribution: YesCT commentedMarking this closed since no response. Please reply if still interested.
Comment #4
vlooivlerke CreditAttribution: vlooivlerke commentedThis has been done by the D5 version of the now called gmaps.module taken over by bdragon
Basically it has a field called "Find location" above the node map in the node create form. First you type your location address in the "find" field and click on the find button. Then depending on the geo options you selected, say google and zip codes, the map will place a marker close to the location entered in the find field.
As the marker gets placed, the corresponding fields also gets populated, City, State, Country,
There lack 2 important fields in the location module, Region and suburb.
The form should look like this:
(field_find_location) with a button called "find"
(field_country)
(field_state)
(field_region)
(field_city)
(field_suburb)
(field_zip)
State and Region fields can be stipulated in the .inc file making it auto complete
City field can be pulled from the zipcode field to make it auto complete
the suburb field can become auto complete slowly as users enter suburb data under a city.
Now to be really fancy the state, region, city and suburb can be generated as a taxonomy.
The way it works now, the map only gets geocoded after you have submitted the node.
Comment #5
goldsounds CreditAttribution: goldsounds commentedHi guys,
I implemented a simple ajax geocode feature on my own site at http://www.watson24hour.com (try to sign in, then click the "register" link, then type a city into the register field and press enter or click "Find me").
If you could include something like this for the location field, the usability would go way up.
Note that I also automatically update the lat/long when they scroll the map, rather than adding a marker. I find people generally prefer this. The rules by which the marker appears/disappears on the location module map at the moment seems somewhat unintuitive.
Thanks for a great module! We plan on using it a lot. I really appreciate all the improvements you've already made.
Cheers,
Dan
Comment #6
vlooivlerke CreditAttribution: vlooivlerke commentedThis is great
I take it the place of the marker is in the center of the map.
A cross hair target will make more sense then, I was a little lost as to where or when the marker will be placed.
Are you going to send the patch?
It would be nice :)
Comment #7
liyanguo CreditAttribution: liyanguo commentedhi goldsounds,
I checked out your site. It looks very cool. Do you think you can share how you did your ajax call?
Thanks
Comment #8
aacraig CreditAttribution: aacraig commentedsubscribing
Comment #9
sydneyshan CreditAttribution: sydneyshan commentedI've attached a location/gmap 7.x solution to this problem - I'd say the code will work with 6.x but I haven't tried.
This module watches out for node add/edit forms and scans for location fields. If some are found it adds them to the $form variable for easy reference, and adds an #after_build to add the buttons in (+ reference the javascript file to provide the front-end geocoding).
Please note this module won't work unless you check the 'Use a Google Map to set latitude and longitude' checkbox (location_usegmap variable) at /admin/config/content/location with the gmap module installed. A 'Find Address on Map' button will appear above each location field map. It will aggregate the provided fields together and send them off to Google Maps to geocode.
Comment #10
sydneyshan CreditAttribution: sydneyshan commentedPlease find an updated version of the location/gmap module for 7.x attached - this one should be compatible with the Google Maps API v3 version of Gmap, when it is released, in addition to being compatible with Google Maps API v2.
Comment #11
sydneyshan CreditAttribution: sydneyshan commentedIf you'd like to follow location_gmap_find_address, please go here: http://drupal.org/node/1921872#comment-7087270
Comment #12
podarok#10 commited to next minor gmap-7.x-2.x release
thanks!