Hi,
I have location and gmap working together OK. There's a problem with the 'See Map' link that should link to the google map for this location. The location info is correct and the gmap appears in the gmap block with a marker for the location, but the link to google maps is incomplete and links as follows:

Location
United Kingdom
52° 21' 8.0532" N, 1° 14' 37.986" W
See map: Google Maps >> links to http://maps.google.co.uk/?q=,+,+,+uk

I can't give street addresses for the locations I want to mark. They'll all be marked with Lat and Long only. And all will be UK locations.

(see http://screencast.com/t/U5ncOjkojk) Please let me know if there's more information you need from me.

Cheers!

Comments

mshepherd’s picture

anyone got any idea about this?
matthew

richardathome’s picture

*bump

Same issue for me. You should pass the longitude/latitude by default if present in the location (not all locations have a full address).

mshepherd’s picture

Just bumping this again. Any ideas?

cleanthes’s picture

Hey Matt, did you get anywhere with this? I have the same problem and like you want to tag UK locations with lat/long only.

cleanthes’s picture

Here's a diff of the file /supported/location.uk.inc which checks whether we have a latlong supplied for this location and if so just uses that, ignoring the address fields. This possibly isn't the best place to put it or the best way to do it, but it does mostly work and it's done in haste.
I can now use the 'See map' link. The only problem I've found is that the google map now appears to show more than one pointer. I'm still investigating this

257,261c257,266
< 
<   foreach (array('street', 'city', 'postal_code', 'country') as $field) {
<     if (isset($location[$field])) {
<       $query_params[] = $location[$field];
<     }
---
> //  print_r($location);
>   if (isset($location['locpick'])) {
>       $query_params['ll']=$location['locpick']['user_latitude'] . "," . $location['locpick']['user_longitude'];
>   } else {
>       foreach (array('street', 'city', 'postal_code', 'country') as $field) {
> 	  if (isset($location[$field])&& $location[$field] != "") {
> 	      print_r($field .":" . $location[$field].",");
> 	      $query_params[] = $location[$field];
> 	  }
>       }
263d267
cleanthes’s picture

Oops, sorry. I left some debug in there. Try this instead

< 
<   foreach (array('street', 'city', 'postal_code', 'country') as $field) {
<     if (isset($location[$field])) {
<       $query_params[] = $location[$field];
<     }
---
>   if (isset($location['locpick'])) {
>       $query_params['ll']=$location['locpick']['user_latitude'] . "," . $location['locpick']['user_longitude'];
>   } else {
>       foreach (array('street', 'city', 'postal_code', 'country') as $field) {
> 	  if (isset($location[$field])&& $location[$field] != "") {
> 	      $query_params[] = $location[$field];
> 	  }
>       }
263d265
< 
yesct’s picture

Is this a problem for UK only?
Could it be related to:
#326665: UK cities are in state/province field

Obsidian1269’s picture

This is a much larger issue that has yet to be touched upon. The problem is primarily with locations outside the United States. The module looks for address and coordinate information and then places that info within the Google Map link. However, it seems to ignore pieces of that information for countries other than the US. In many cases, the See Map link doesn't even show up! This needs to be committed. I can show you the issue on my website. Check the following links.

Inside the US:
http://www.ratemyskate.com/content/skate-spot/157/brooklyn-banks
http://www.ratemyskate.com/content/skate-park/50/san-rafael-skatepark
http://www.ratemyskate.com/content/skate-spot/183/raspberry-island-4-stair

Loss of Information (generally in the UK):
http://www.ratemyskate.com/content/skate-park/277/perth-skate-park
http://maps.google.co.uk/?q=,+Dundee,+,+uk

Not Showing Up At ALL:
http://www.ratemyskate.com/content/skate-park/272/plaza-para-hacer-skate-2
http://www.ratemyskate.com/content/skate-park/68/%E6%AD%A6%E8%94%B5%E9%8...

entilza72’s picture

@Obsidian1269 (#8), from your description, this sounds very similar to the problem I am having.

I just posted about it previously here http://drupal.org/node/884552

Any imbeded map and map link both appear to be missing street level information outside of the US and Australia (they only go to suburb level, sometimes region level). Keep in mind gmaps has an option to withhold map data if it is below a specific level of accuracy - your maps may not be showing up because of that. But the problem I am having (and you appear to as well) is that street level info is not being sent to google for some countries, OR google is being told to detune the accuracy to suburb level or less.

In my post, I have demo'ed how to perfectly replicate the same inaccurate "suburb or region level only" results on maps.google.com simply by removing the street name and number - my question was around "what is different to Location -> Gmaps which appears to lose this info, vs using maps.google.com which gets it right".

Cheers,
Jason.

entilza72’s picture

@YesCT (#7) - if we are talking about the same thing, I also have found the problem with Japan. I am sure there are many others.

Jason

Obsidian1269’s picture

Okay so entilza72 and I have been talking about this and from what we discovered, it looks like all the different countries have a location.[CountryNameHere].inc file that tells the module how to deal with each country respectively. After viewing the code in each of these files, it appears the module is simply incomplete. The .inc file for the United States is enormous and details a function called "function location_map_link_us_google" that tells the module how to create the "See Map" link. However, for countries like the UK, that function, which is called "function location_map_link_uk_google," respectively, is simply not as precise. It leaves out crucial information when dealing with the input provided. I tried replacing this function with the one from the US .inc file and it worked like a charm. After viewing a few more .inc files, it became apparent that many of them had no functions at all. Therefore, it appears the module was made to only deal with a select number of countries. The rest simply have no support and it would take a VERY long time for me to go through all of them and paste this function in. Anybody want to commit a patch??? Please!?!?

Proof that the UK links work now...

http://www.ratemyskate.com/content/skate-park/277/perth-skate-park

entilza72’s picture

Great work Obsidian1269 - this begs the question: why does the module need different .inc files per country? OK, there's the obvious local regional/state abbreviations, but other than that ...

Two potential reasons I can think of:
1. To use a local google. Not really all that important as far as I can tell (vs having a working module!).
2. To present relevent fields for that country (eg, the UK has no "states"). But one of the points of google maps geolocation is that it will take unstructured data and turn it into appropriate structured data. Your modification proves this.

A patch sounds like a great idea. :-)

Jason.

jindustry’s picture

I solved some of the issues mentioned here with two patches I found on these threads:
http://drupal.org/node/584014#comment-3415628
http://drupal.org/node/403634#comment-3518958

I've just started using the Location / Gmap modules, and I'm surprised at the lack of support / priority for non-USA addresses. I'm installed the latest 6.x-3.x-dev 2010-Sep-30 Location module.

I had 2 issues to address:

  1. A map for a node with a location in South Africa did not display on my node page because Location module didn't support geocoding for South Africa. The first patch adds the support of geocodiing more countries therefore allowing maps from more countries to be displayed.
  2. The link to open a google map was also missing for the South African address. The second patch solves this. It's a bit of a hack that obviously bypasses the intended mechanism reported by Obsidian1269.
legolasbo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing old D6 issues as D6 is end of life