/**
* Get the list of marker titles.
*/
function gmap_get_marker_titles($reset = FALSE) {
static $titles;

if (!reset) {
if (is_array($titles)) {
return $titles;
}

In the above snippet in the gmap.module, I think the !reset should be !$reset. This is a minor typo. (in the 1002 line)

secondly, I add a new function to the gmap.module
The function extends the original gmap_simple_map, the gmap_simple_map can only show a marker in the map. I want to show multiple markers in the map.
/**
* Simple way to draw a map from inside a theme.
* @param $latitude
* Latitude of marker.
* @param $longitude
* Longitude of marker.
* @param $markername
* Marker to use.
* '' will fall back to google's default marker.
* @param $info
* What to show in the bubble when the marker is clicked.
* Leave blank if you don't want a bubble.
* @param $zoom
* Map zoom.
* 'default' will use the default zoom from the settings page.
* 3 is usually a good value to use.
* @param $width
* Map width.
* 'default' will use the default width from the settings page.
* @param $height
* Map height.
* 'default' will use the default height from the settings page.
* @param $autoshow
* If set to TRUE, automatically show the marker bubble.
* @param $map
* Override parts of the map array.
* If you need to do much with this, you should probabaly be putting together
* the map array manually.
*/
function gmap_multi_marker_map($makerlist = array(),$zoom = 'auto', $width = 'default', $height = 'default', $autoshow = FALSE, $map = array()) {
$settings = array(
'id' => gmap_get_auto_mapid(),
'latitude' => $makerlist[1]['latitude'], // Center the map
'longitude' => $makerlist[1]['longitude'], // on the marker.
);
if ($zoom != 'default') {
$settings['zoom'] = $zoom;
}
if ($width != 'default') {
$settings['width'] = $width;
}
if ($height != 'default') {
$settings['height'] = $height;
}
if(!empty($makerlist)){
$settings['markers'] = $makerlist;
}
if ($autoshow) {
$settings['markers'][0]['autoclick'] = TRUE;
}
if (!empty($map)) {
$settings = array_merge($settings, $map);
}
return theme('gmap', array('#settings' => $settings));
}

Comments

tinem’s picture

Would it be possible to get a link to your map using multiple markers for study, please?

And is it a BUG?

mpruitt’s picture

Priority: Normal » Critical

First, thanks tingan for posting this. I used this example for a project I'm working on.

Second, I made a wee change.

Where you have:

function gmap_multi_marker_map($makerlist = array(), $zoom = 'auto',

I had to change the code to the below to make it work:

function gmap_multi_marker_map($makerlist, $zoom = 'auto',
rooby’s picture

Priority: Critical » Normal

This isn't critical.

Please post patches if you have code changes.
You can find information on patches at http://drupal.org/patch

Also, it is preferable to keep one issue per issue.

EvanDonovan’s picture

Title: a bug in gmap.module and an enhancement to gmap.module » add a function similar to gmap_simple_map() for rendering multiple markers on a map
Version: 6.x-1.1-rc1 » 6.x-1.x-dev
Category: bug » feature
Priority: Critical » Normal

The bug is fixed in 6.x-1.x-dev.

If you want the gmap_multi_marker_map() function to be committed, you will need to post as a patch.