Styled Google Map is a module that integrates as a geofield formatter. You have options that include setting a custom map style, custom marker and custom marker icon.
Installation
Install and enable the Geofield module and its required module Styled Google Map in the usual way. Learn more about installing Drupal modules.
Basic usage
- After creating a geofield go to the Manage Display tab
- On your desired display select the Styled Google Map formatter
- Setup the options by clicking on the cogwheel
- Save the display
• Using a custom map style
Google Maps API v3 allows for styled maps. A style is represented by an array of map features and stylers. Snazzy maps already contains some examples you can use. In case you want to create your own style or want to alter a style you can use this github page to create your own. Using your chosen style can be done by saving the JSON Style field with your style array.
• Using a custom pin
Set the URL to the marker field. This field can accept any path using the System stream wrapper Module. The module has an example thanks to GraphicsDrawer
• Using a custom popup/info window
You are allowed to choose a field or view mode. Selecting a field should be sufficient if you just want to show the address or title. In case you want to show a more complex popup. You can select a view mode that has multiple fields (Ex. teaser view mode). Using view modes also support the use of Field Groups.
Theming
In case the default rendering of the map and settings should be altered. You can overwrite the theming function.
/**
* Returns HTML for the styled google map.
*
* @param array $variables
* An associative array containing:
* - location: The location object including longitude and latitude.
* - display: Display array including formatter settings.
*
* @ingroup themeable
*/
function theme_styled_google_map(array $variables) { }
Attachment | Size |
---|---|
styled-google-map-style-map-setting.png | 36.78 KB |
styled-google-map-style-map-pin-setting.png | 19.77 KB |
styled-google-map-style-map-view-mode-setting.png | 10.59 KB |
Comments
Colors for Different Countries
By using this module I can change the colors of "landscape" but not for different countries. Actually I want to apply different color for different country. How is it possible???