Skip to content

Instantly share code, notes, and snippets.

@commercial-hippie
Last active June 29, 2016 12:33
Show Gist options
  • Save commercial-hippie/8570069 to your computer and use it in GitHub Desktop.
Save commercial-hippie/8570069 to your computer and use it in GitHub Desktop.
Drupal - GMap - Render map with multiple markers in a template file
<?php
$latitude = '49.19258642226091';
$longitude = '-123.17647933959961';
$settings = array(
'id' => 'mymap',
'latitude' => $latitude, // center the map
'longitude' => $longitude, // on the marker
'zoom' => 10,
'width' => '100%',
'height' => '490px',
'type' => 'Satellite',
);
$settings['markers'] = array(
array(
'latitude' => $latitude,
'longitude' => $longitude,
// 'markername' => 'asd',
// 'offset' => 0,
),
array(
'latitude' => '49.59258642226091',
'longitude' => '-123.57647933959961',
// 'markername' => 'asd',
// 'offset' => 0,
)
);
// echo theme('gmap', array('#gmap_settings' => $settings));
$element = array(
'#type' => 'gmap',
'#gmap_settings' => $settings,
);
echo drupal_render($element);
@andreconghau
Copy link

Hi,

There is useful.

Could gmap marker tooltip and label by this way.

Thanks

@MichalWi
Copy link

Thank you very much for this snippet.

Andre see here http://www.passivhuscentrum.se/sites/all/modules/gmap/help/api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment