Hi, I cannot set a location to a node using the address fields.
After having entered the address in the fields, it is not geocoded:
- the map display in the submit form is not updated when I hit "tab" after having entered the address
- the lat / lon fields are empty in the database ("NULL")

[ The only way to set a location for a node is to either:
- click on the map => the lat / lon fields are automatically filled in, the marker added
- fill in the lat/lon fields => marker added ]

Question: how to get the entered address correctly geocoded to set the location to the node?

Comments

BobLouis’s picture

Version: 5.x-0.5 » 5.x-1.x-dev

To be more precise: I have no problems getting an address with maps.google.com, where geocoding is done ok.
Why should there be a problem geocoding that same address using these modules:
- location
- gmap
- gmap location module

Is it something I have missed in the settings?

BobLouis’s picture

One more info -still hoping that someone will answer ;)
=> I cannot have even the Gmap macro working. When I enter an address and then hit "tab", the map remains unchanged.
Entering the very same address at maps.google.com gives back a map...

michelle’s picture

For the address geocoding, make sure you hit these hard to notice settings pages:

admin/settings/location/maplinking
admin/settings/location/geocoding

The map doesn't get updated when you hit tab; only after you submit.

On the macro page, the address textbox doesn't do anything useful for me, either.

Michelle

BobLouis’s picture

Michelle,

Thank you very much for your response.
I checked those two pages, where it is said :
- Maplinking : "None supported"
- Geocoding : "None supported - No service selected for country"

I am trying to find addresses in France, and I don't understand why it should not work for France since it works perfectly on the Google Maps service itself (maps.google.com). Why do we need a geocoding service when the one of Google is included in their service?

BobLouis’s picture

Actually it seems that Google recently announced that geocoding is available for most Western European countries (besides USA/Canada).
See :
- http://www.google.com/apis/maps/documentation/#Geocoding_Etc
- http://www.developer.com/lang/jscript/article.php/3615681

But unfortunately, unless I am wrong, the location module still considers geocoding as "not supported" for these countries.
Do you know if it's going to be updated accordingly?

bdragon’s picture

Project: GMap Module » Location
cm983’s picture

i have the same problem the map wont show the markers unless i click on the map and set a lon/lat. why cant it use the info from the address fields?

danielb’s picture

same problem. marker isn't placed, doesn't even zoom in on the suburb, typing in an address does bugger all...

danielb’s picture

Hi guys, I have successfully made this work. Not for tabbing, but when you type in an address, save, then come back to the form.

I don't have a great understanding of this module so I'm not submitting a patch, but if you care to determine how I did it, I edited the file location.module, about line 732 there is an 'if' statement I had to modify the contents of.

<?php

    if (user_access('submit latitude/longitude')) {
      for ($index = 0; $index < $location_form_count; $index++) {
        $form['locations'][$index][] = array(
          '#type' => 'markup',
          '#value' => "<br/>\n"
        );
        
        if ($node->nid || isset($node->locations[$index]['previous_source'])) {

          $full_address = $node->locations[$index]['street'].' '.$node->locations[$index]['additional'].' '.$node->locations[$index]['city'].' '.$node->locations[$index]['province'].' '.$node->locations[$index]['postal_code'].' '.$node->locations[$index]['country'];
          $gmap_geocode = gmap_geocode($full_address);
          $form['locations'][$index]['previous_source'] = array(
            '#type' => 'hidden',
            '#value' => $node->locations[$index]['source']
          );

          $form['locations'][$index]['previous_latitude'] = array(
            '#type' => 'hidden',
            '#value' => $node->locations[$index]['latitude'] ? $node->locations[$index]['latitude'] : ($gmap_geocode['latitude'] ? $gmap_geocode['latitude'] : '')
          );

          $form['locations'][$index]['previous_longitude'] = array(
            '#type' => 'hidden',
            '#value' => $node->locations[$index]['longitude'] ? $node->locations[$index]['longitude'] : ($gmap_geocode['longitude'] ? $gmap_geocode['longitude'] : '')
          );

        }

        if ($node->locations[$index]['latitude']) {
          $gmap_geocode['latitude'] = $node->locations[$index]['latitude'];
        }
        if ($node->locations[$index]['longitude']) {
          $gmap_geocode['longitude'] = $node->locations[$index]['longitude'];
        }

        //$form['locations'][$index] = array_merge($form['locations'][$index], location_latlon_form(t('If you wish to supply your own latitude/longitude, you may do so here.  Leaving these fields blank means that the system will determine a latitude/longitude for you, if possible.'), $node->locations[$index] ? location_api2form($node->locations[$index]) : array()));

        $form['locations'][$index] = array_merge($form['locations'][$index], location_latlon_form(t('If you wish to supply your own latitude/longitude, you may do so here.  Leaving these fields blank means that the system will determine a latitude/longitude for you, if possible.'), $gmap_geocode ? $gmap_geocode : array()));
      }
    }


?>

If you compare the original code, and my code there, you will see I have added a call to the function gmap_geocode() from the gmap module to try and get a proper lat/lon for the marker, based on the location fields (you may have different fields so theres another reason this wouldn't work as a patch to the module), and then I try to use this value instead of the null value or whatever you normally get

yesct’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +location geo-coding

This issue is really old, and there have been lots of improvements; I think it might be in the latest version. Could someone please confirm this in the latest version? I'll mark it as postponed (needs more info).

yesct’s picture

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