HI. I seem to be having issues with the GMap Theme function:
// create array for gmap
$map_array['id'] = $gmap_id;
$map_array['width'] = ($node->field_gmap_width) ? $node->field_gmap_width : '100%';
$map_array['height'] = ($node->field_gmap_height) ? $node->field_gmap_height : '300px';
$map_array['latitude'] = ($node->location['latitude']) ? $node->location['latitude'] : '41.9023';
$map_array['longitude'] = ($node->location['longitude']) ? $node->location['longitude'] : '-87.5391';
$map_array['maptype'] = ($node->field_gmap_maptype) ? $node->field_gmap_maptype : 'Terrain';
$map_array['controltype'] = ($node->field_gmap_controltype) ? $node->field_gmap_controltype : 'Large';
$map_array['zoom'] = ($node->field_gmap_zoom) ? $node->field_gmap_zoom : '7';
// create markers
$marker = array(
'text' => 'Hi', //phptemplate_gmapnodelabel_life_map($node, $opt),
'longitude' => ($node->location['latitude']) ? $node->location['latitude'] : '41.9023',
'latitude' => ($node->location['longitude']) ? $node->location['longitude'] : '-87.5391',
//'markername' => ($node->field_gmap_markername) ? $node->field_gmap_markername : 'Green',
);
$map_array['markers'][] = $marker;
return theme('gmap', $map_array);
This is how API.txt describes how to do this. But looking into the code a little I add the following and get the correct map settings but no markers:
$map_full['#settings'] = $map_array;
return theme('gmap', $map_full);
Comments
Comment #1
bdragon commentedTry specifying 'markername' and 'offset' on the marker.
Comment #2
bdragon commentedAssuming you were able to fix it.
Comment #3
Fintan Darragh commentedFor future reference, the actual cause of this problem was that the 'latitude' and 'longitude' values were mixed up.
So these lines:
...should read:
Hope this helps.
-Fintan