When an address in entered the location module does not automatically determine the lat and long or insert the data in the the database.

Comments

snufkin’s picture

Version: 4.7.x-1.x-dev » 6.x-3.x-dev
Status: Closed (fixed) » Active

I also have this problem. For my site it would be better to only enter locations via entering City and Country, but this leaves the mysql fields empty afterwards, leaving NULL values in longitude and latitude.

Still valid problem with the recent cvs version.

jamesJonas’s picture

Summary: Geocoding needs to be repaired and enabled inside the location.module. Returned geocoded results needs to populate lat/lon, address and set the zoom level on the gmap based on accuracy.

See post: http://drupal.org/node/71246

This post shows how I solved part the problem. In addition to the above hacks, I also had to repair the gmap module to populate lat/lon. I prefer using both geocoding AND gmaps to help the customer specify a lat/lon location.

Scenarios:
(1) city, state, country -> geocode service (google)-> returns lat/lon -> gmap with marker -> user refine lat/lon via drag or click on a gmap
(2) zipcode -> geocode service -> lat/lon -> gmap with marker -> refine with gmap
(3) street, city, state, country -> geocode -> lat/lon -> gmap with marker -> gmap refine or verify
(4) county, state, country -> (same steps)
(5) lat/lon (via gps) -> (same steps)

The geocode service returns more that just lat/lon. It includes error codes, accuracy levels and a complete addresses (as much as is possible). Here is a KML example of what is returned via Google.



1600 amphitheatre mtn view ca

200
geocode

1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA



US

CA

Santa Clara

Mountain View

1600 Amphitheatre Pkwy


94043







-122.083739,37.423021,0



Potential New Features for Location.module

(1) provide the user with a single address line. User fills out what they know. Let the geocode service parse the address and return lat/lon, accuracy level and as complete an address as is possible. SubAdministrativeAreaName or in other words county/district needs to be added to location.module, location.inc and location_views.module. I may post a patch if anyone is interested in adding county/district.

(2) Drupal (based on a set of rules that I still need to think about) may update the appropriate fields for the location.

(3) A gmap provides a feedback, verify and refinement mechanism for the user.

(4)The Edit page only contains the single line address. The location fields and the map are push into a tab behind the edit page. I find the location fields and the map to be a bit of a distraction from a simple edit that I wish to user to perform.

(5)The zoom level of the gmap needs to be set by the accuracy level returned by the geoservice.

I have used Google in this example, but Yahoo also offers another alternative geocode service. Skip the geocode.us service due to licensing issues.

Motivation: Better Internationalization and more natural and intuitive user interaction.

Hope this helps.

jamesJonas’s picture

My XML tags where stripped out above since I did not add a code tag. Here is the xml kml with the tags. Note that I change one line from code to codechanged below.

<kml>
  <Response>
    <name>1600 amphitheatre mtn view ca</name>
    <Status>
      <codechanged>200</codechanged>
      <request>geocode</request>
    </Status>
    <Placemark>
      <address> 
        1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA
      </address>
      <AddressDetails Accuracy="8">
        <Country>
          <CountryNameCode>US</CountryNameCode>
          <AdministrativeArea>
            <AdministrativeAreaName>CA</AdministrativeAreaName>
           <SubAdministrativeArea>
             <SubAdministrativeAreaName>Santa Clara</SubAdministrativeAreaName>
             <Locality>
               <LocalityName>Mountain View</LocalityName>
               <Thoroughfare>
                 <ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName>
               </Thoroughfare>
               <PostalCode>
                 <PostalCodeNumber>94043</PostalCodeNumber>
               </PostalCode>
             </Locality>
           </SubAdministrativeArea>
         </AdministrativeArea>
       </Country>
     </AddressDetails>
     <Point>
       <coordinates>-122.083739,37.423021,0</coordinates>
     </Point>
   </Placemark>
  </Response>
</kml>
dgrant’s picture

Version: 6.x-3.x-dev » 4.7.x-1.x-dev
StatusFileSize
new891 bytes

I have a simple workaround to this. It allows me to have the location, location_views, gmap, gmap_location modules all enabled, and to have the "Allow users to add Google Maps info to this node type" enabled as well as "Enable the submission of a location for content of this node type." under the admin/settings/content-types options. I've attached a very small patch to the location module. Essentially what it does is, if the "Allow users to add Google Maps info to this node type" option is enabled for a node, the location module will grab the lat/long info from whatever the user had in the gmap thingy for lat/long (which originally came from an address that I gave it).

This allows me to have all the features of the location module, but the gmap module piggybacks and allows me to set the lat/long from an address quickly and easily. Zooming in on the world map and looking for a street and clicker a marker just wasn't doing it for me.

I can create a custom view for a CCK node type that uses the "Gmap View" and I can also go to the "map/node" URL to see a map of all my node's locations. But really, making a custom view is the way to go, and in order to get the custom view working with the views module I needed to allow location information for the CCK node type.

dgrant’s picture

StatusFileSize
new715 bytes

Apologies for the coloured diff. Attaching normal one.

dgrant’s picture

StatusFileSize
new478 bytes

Sorry I forgot you need this patch for gmap_location.module as well.

bdragon’s picture

Status: Active » Closed (fixed)

Closing issue, I believe this has been fixed for over a year.

danielb’s picture

well it's not fixed mate, I just downloaded your module and it's fucked.

summit’s picture

Subscribing does this also work for D6?
greetings, Martijn

gstout’s picture

Still broken

yesct’s picture

Version: 6.x-3.x-dev » 4.7.x-1.x-dev
Status: Active » Postponed (maintainer needs more info)

gstout, please provide more information, such as the specific data you used, the result you expected, the actual result, and a step by step for how to reproduce it. Thanks. With more information, I might be better able to tell if this is really the same issue as this, maybe the same as another issue, or needs to be a new issue.

summit’s picture

Version: 4.7.x-1.x-dev » 6.x-3.x-dev

Hi,

Could this also have to do with http://groups.drupal.org/node/27864 fix 3 in the diff?
In English it says: If you give location the lat,lon through say a feed, than location is going to screw up the lat, lon, instead of leaving it alone, because the fields are already filled..
therefore:

 if (  $node->{$field_name}[$i]['latitude']
>            && $node->{$field_name}[$i]['longitude']  ) {
>             $node->{$field_name}[$i]['inhibit_geocode'] = true;

didn't test with latest location, but no responses on the group-post, so I asume this is still the case?

greetings, Martijn

gstout’s picture

Sorry, not broken , just confusing setup. See here. http://drupal.org/node/856244#comment-3217470

yesct’s picture

Martijn, does the link gstout gave help?

rooby’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Closing due to inactivity.

Please reopen if this is still an issue in the latest version.