Location map block does not center
Dave Cohen - December 19, 2007 - 18:06
| Project: | GMap Module |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
When I assign a node a location, and enable the gmap block, all the maps look the same. They show Highway 6 and Interstate 80 near Adair. As shown in the attached image.
When I edit the nodes, the map I see in the location form shows the correct location. But all maps in blocks show this.
| Attachment | Size |
|---|---|
| gmap_anita.jpg | 11.41 KB |

#1
I believe I was missing a file, through my own careless use of CVS.
Anyway, this problem is not happening any more.
#2
I don't know why I thought this was working. It turns out the map that appears in the location block does set a marker, but does not center over it. I noticed there is code in gmap_location_node_page() that does this:
<?php// Special stuff for single marker
if ($count == 1) {
// Center map on only marker.
$map['latitude'] = $map['markers'][0]['latitude'];
$map['longitude'] = $map['markers'][0]['longitude'];
?>
But there is no equivalent in gmap_location_block_view().
#3
+1
#4
I had the same issue... I did several things... what about starting with gmap_location.module and add the following snippet:
$map[latlong]=(($loc['latitude']).','.($loc['longitude']));right before the function gmap_location_block_view ends, I mean before:
$block['subject'] = t('Location');$block['content'] = theme('gmap', array('#settings' => $map));
Let me know if that works... you can also go to the gmap.module and in the function theme_gmap insert a
print_r ($map)to check how the location is encoded in the $map array adequately.
#5
Here's what I did. Maybe too simple to be the general solution. But it works for me where my location block shows only one marker at a time.
#6
Pleas have a look at: http://drupal.org/node/191223