Last updated 22 January 2011. Created on 11 May 2009.
Edited by cousin_itt, jhodgdon, gmateos. Log in to edit this page.

I needed to show a Google Map with a mouseover text. When the user clicks on marker, we must link to marker's node page.
To implement this, I used gmap, views and some tpl:

1) Create a view. use wathever name you want, but remember it in order to create tpl file. I used "sitios_gus_mini"
2) Configure filters to match your preference.
3) Choose style "Table" and ensure to select location fields: latitude and longitude are a must. I added Title, nid and type too.
3) Test the view, ensure some data is selected. Ensure latitude and longitude data have valid values and have their display style set to 'Decimal degrees'.
4) Create the tpl for the view. In my case, the name is "views-view-table--sitios-gus-mini--block-1.tpl.php" (note the word "table" because is the style of view, and "sitios-gus-mini" because is name's view). The word "block" is because I created a block view.
5) One problem I had to deal with: "Views" provide the "node type's description", not the code, and this was a problem because I had markers related with "content type codes"...mmm...need some trick...(look at first lines of tpl's code to see it)
6) The php code for tpl is the following:

// $Id$
 * @file views-view-table.tpl.php
 * Template to display a view as a table.
 * - $title : The title of this group of rows.  May be empty.
 * - $header: An array of header labels keyed by field id.
 * - $fields: An array of CSS IDs to use for each field id.
 * - $class: A class or classes to apply to the table, based on settings.
 * - $row_classes: An array of classes to apply to each row, indexed by row
 *   number. This matches the index in $rows.
 * - $rows: An array of row items. Each row is an array of content.
 *   $rows are keyed by row number, fields within rows are keyed by field ID.
 * @ingroup views_templates
$markertypes = variable_get('gmap_node_markers', array());
$node_types = node_get_types('names');
// we do a reverse lookup here, because views give me the "node type description" and not the "node type code" and we have the icon information by "node type code"
foreach ($node_types as $type => $name) {
  $node_names[$name]=$type;// this is what we need: key: name, data:tyep
foreach ($rows as $count => $row) {
      'markername' => isset($markertypes[$node_type]) ? $markertypes[$node_type] : 'drupal',
      'latitude' => $row['latitude'],
      'longitude' => $row['longitude'],
      'opts'=> array('title' =>$row['title']), //este es el popup cuando mouseover
      'link'=> check_url(url('node/'.$row['nid'], array())),

$arr_map = array(
  'id' => 'sitiosmini',
  'zoom' => 5,
  'width' => '300px',
  'height' => '300px',
  'latitude' => $markers[0]['latitude'],
  'longitude'=> $markers[0]['longitude'],
  'maptype' => 'Map',
  'controltype' => 'Small',
  'markers' => $markers,
print  theme('gmap', array('#settings' => $arr_map));

Looking for support? Visit the forums, or join #drupal-support in IRC.