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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SocialNicheGuru’s picture

subscribing

YesCT’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +location validation, +location auto-complete, +location geo-coding, +location hierarchial select or ajax

tagging 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.

YesCT’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Marking this closed since no response. Please reply if still interested.

vlooivlerke’s picture

Status: Closed (fixed) » Active

This 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.

goldsounds’s picture

Hi 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

vlooivlerke’s picture

This 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 :)

liyanguo’s picture

hi goldsounds,

I checked out your site. It looks very cool. Do you think you can share how you did your ajax call?

Thanks

aacraig’s picture

subscribing

sydneyshan’s picture

I'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.

sydneyshan’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
FileSize
3.51 KB

Please 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.

sydneyshan’s picture

If you'd like to follow location_gmap_find_address, please go here: http://drupal.org/node/1921872#comment-7087270

podarok’s picture

Status: Active » Fixed

#10 commited to next minor gmap-7.x-2.x release
thanks!

Status: Fixed » Closed (fixed)
Issue tags: -location validation, -location auto-complete, -location geo-coding, -location hierarchial select or ajax

Automatically closed -- issue fixed for 2 weeks with no activity.