I was wondering if there are options to create dynamic markers by specifying icon path, size etc
as a parameter in settings when calling the gmap api theme('gmap', array('#settings' => $map_array1));

In that way, a user could use the content of a cck image field.

$map_array1 = array(
'id' => "mymap", // id attribute for the map
'width' => $width, // map width in pixels or %
'height' => $height, // map height in pixels
'zoom' => $xzoom, // zoom level
'maptype' => "Map", // baselayer type
'controltype' => "Small", // size of map controls
'markers' => array(),
);

$map_array1['markers'][] =array(
'text' => '

'.$xtext.'

',
'latitude' => 39,
'longitude' => 22,

'icon' => array(
'image'=> 'http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png',
'shadow'=> 'http://chart.apis.google.com/chart?chst=d_map_pin_shadow',
'iconSize'=> '12, 20',
'shadowSize'=> '22, 20',
)

);

theme('gmap', array('#settings' => $map_array1));

CommentFileSizeAuthor
#2 filefield.patch3.61 KBsreynen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sreynen’s picture

Category: support » feature

FYI, I'm going to try to do a patch to make custom field marker work with image fields.

sreynen’s picture

FileSize
3.61 KB

I got this working to use the image if the field referenced by the custom field maker is a file field. But an image alone isn't enough information about a marker for Google maps. It also needs to know the size of the image and the anchor point, at a minimum. Ideally there would be an offset for the info window and a shadow image. I got the size loading with image_get_info(), and just set the anchor point to halfway on the bottom. That works for the site I'm doing, but isn't good for general use. So this patch is admittedly a hack, but at least a start for anyone who wants to do this right.

johnv’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, filefield.patch, failed testing.

podarok’s picture

Version: 6.x-1.0 » 7.x-2.x-dev
Status: Needs work » Needs review

feature request should be rolled against latest dev and then after commit backported to 6.x branch

podarok’s picture

#2: filefield.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, filefield.patch, failed testing.