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.

AttachmentSize
gmap_anita.jpg11.41 KB

#1

Dave Cohen - December 20, 2007 - 11:10
Status:active» fixed

I believe I was missing a file, through my own careless use of CVS.

Anyway, this problem is not happening any more.

#2

Dave Cohen - December 29, 2007 - 19:04
Title:All block maps show Anita and Adair» Location map block does not center
Status:fixed» active

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

inozz - January 8, 2008 - 07:16

+1

#4

Furayo - January 20, 2008 - 06:02

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

Dave Cohen - January 31, 2008 - 12:28
Status:active» patch (code needs review)

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.

AttachmentSize
centermap.diff862 bytes

#6

smitty - February 3, 2008 - 18:38
Status:patch (code needs review)» duplicate

Pleas have a look at: http://drupal.org/node/191223

 
 

Drupal is a registered trademark of Dries Buytaert.