I am trying to implement geocoding to function for user profiles. Here's my current setup:

When editing a nonadmin registered user's profile I see Location section collapsed. Inside Location I can edit Location name, Street, City, State/Provinde, Postal code, Country, Latitude, Longitude. Additionally I see a GMap above Latitude and Longitude fields as I have the GMap module enabled.

When I input an address and save the profile, upon next view the latitude and longitude fields are still black. Also, the GMap doesn't point to the location specified by the address.

I would like to configure teh site to geocode the address into lat./long. either server-side once the form is submitted or in real-time using javascript when the location fields are manipulated. Glancing the at the source of teh page I didn't notice any related javascript code loaded to handle geocoding.

Here's my site configuration:

admin/settings/location
Default country selection: United States
Toggle location display: Enable the display of locations.
Province display: Display province/state code.
Use a Google Map to set latitude and longitude
Location chooser macro: [gmap]

admin/settings/location/maplinking
United States: Google Maps enabled

admin/settings/location/geocoding
United States: Google Maps enabled

admin/settings/location/geocoding/us/google
Google Maps API Key: Specified
Google Maps Geocoding Accuracy for us: Premise (building name, property name, shopping center, etc.) level accuracy

admin/settings/gmap
Google Maps API Key: Specified

admin/settings/gmap_location
User settings: User Map: Macro: [gmap |id=usermap|center=40,0|zoom=3|width=100%|height=400px]

I am not sure what I missed. Any ideas?

Comments

mizerydearia’s picture

Also note that I am testing as admin user and therefore permissions should not have an impact at this time.

I examined geocoding/google.inc, location.inc and location.module and found that upon submitting/saving changes to user profile, no server-side code related to generating or establishing geocoding data is executed.

I believe geocoding/google.inc is related, however I also verified that the file is not even parsed or loaded when viewing edit profile page or saving/updating profile.

# grep -r google.inc *
CHANGELOG.txt: - Modernize the HTTP geocoder call in google.inc.
geocoding/google.inc:// $Id: google.inc,v 1.11.2.4 2010/05/27 12:16:14 rooby Exp $
translations/location.pot:#  google.inc,v 1.11.2.4 2010/05/27 12:16:14 rooby
translations/location.pot:#: locations.tpl.php:2 location.inc:575 location.views.inc:94;99;352 location.module:217;1716;38 location.info:0;0 location_node.info:0 location_user.info:0 contrib/location_addanother/location_addanother.info:0 contrib/location_cck/location_cck.module:38;122 contrib/location_fax/location_fax.views.inc:19 contrib/location_fax/location_fax.info:0 contrib/location_phone/location_phone.views.inc:19 contrib/location_phone/location_phone.info:0 contrib/location_search/location_search.info:0 contrib/location_taxonomy/location_taxonomy.info:0 geocoding/google.inc:220 handlers/location_views_handler_filter_proximity.inc:251 plugins/contexts/location.inc:14;15
translations/location.pot:#: location.inc:575 geocoding/google.inc:220
translations/location.pot:#: geocoding/google.inc:164;172 supported/location.au.inc:323
translations/location.pot:#: geocoding/google.inc:166
translations/location.pot:#: geocoding/google.inc:176
translations/location.pot:#: geocoding/google.inc:184 supported/location.au.inc:332
translations/location.pot:#: geocoding/google.inc:187 supported/location.au.inc:335
translations/location.sv.po:#  google.inc,v 1.11.2.3 2009/06/29 14:11:16 bdragon
translations/location.sv.po:#: geocoding/google.inc:210
translations/location.sv.po:#: geocoding/google.inc:210
translations/location.sv.po:#: geocoding/google.inc:164;172
translations/location.sv.po:#: geocoding/google.inc:166
translations/location.sv.po:#: geocoding/google.inc:176

It appears that the geocoding/google.inc file isn't even used.

Although, it seems I am wrong according to line 600 of location.inc: $files = file_scan_directory(drupal_get_path('module', 'location') .'/geocoding', '\.inc$', array('.', '..', 'CVS', '.svn'));

However, the location_get_general_geocoder_list() function does not execute on edit page of user profile nor on saving user profile. Therefore it appears user profile does not have any geocoding integration.

This also is not executed for editing/saving user profile:
Lines 536-538 of location.inc:

function location_load_geocoder($geocoder) {
  include_once drupal_get_path('module', 'location') .'/geocoding/'. $geocoder .'.inc';
}

Function location_load_geocoder is called twice, once in location.inc:361 and once in location.module:752

In location.inc the location_latlon_exact function contains the call to location_load_geocoder. This function is also not executed when viewing edit user profile page or saving the edit profile page.

In location.module the location_geocoding_parameters_form function contains the call to location_load_geocoder. This functiomn is also not executed when viewing edit user profile page or saving the edit profile page.

Is there somewhere I am missing that triggers geocoding address data from user profile location fields?

chris_car’s picture

I need something similar and I found this post: http://drupal.org/node/899624 Hope it helps!

legolasbo’s picture

Status: Active » Closed (outdated)

Closing old D6 issues as D6 is end of life