How to add Custom Markers for Gmap Module Drupal

Updated: 12 March, 2016 seen 3,753

Gmap custom markers are cool way to enhance your Drupal site. My blog heavily really on Drupal Views + Gmap + Location module. Most of the articles listed in Restaurant reviews, tourist attractions or hotel reviews are nicely displayed on map and pinned with custom created markers.

Recently, when updating Gmap module to the latest stable version all my markers disappeared so I had to re-upload markers. That' s how I decided to write a simple tutorial on how to add custom markers in Drupal using Gmap module.

Custom markers using Gmap module

Custom markers using Gmap module

All markers in Gmap module are stored in markers folder, we will create a new folder inside it and will upload our config files and actual marker pins to it. There are a dozen of free markers you can download or you can draw your markers if you are familiar with Photoshop or any other drawing program. 

  • Create a new folder Custom in sites/all/modules/gmap/markers so it looks like this /sites/all/modules/gmap/markers/custom
  • Create a new file custom.ini and paste following
; Defaults
; Note: An empty shadow property will break IE.
; Leave it commented out if you aren't supplying an image.
;shadow = ""
anchorX = 10
anchorY = 29
infoX = 17
infoY = 6

; Marker sets
name = "Services"
sequence = "services.png"

; Files
  • Upload custom marker ico file to custom folder (from above example it' s named services.png)
  • For adding more custom markers use following sytax in custom.ini file
name = "Entertainment"
sequence = "entertainment.png"

N.B. If you have cache enabled, clear cache, run cron and finally delete gmap_markers.js file from files/js in order Drupal can regenerate it

How to add custom marker for Drupal Taxonomy pages

I prefer to add custom markers to taxonomy pages - choose your term name, click edit and scroll down for Gmap Marker settings dropdown menu (from where select your custom marker)

Drupal taxonomy pages with custom marker

Drupal taxonomy pages with custom marker

N.B. You will have to enable Gmap for taxonomies from modules page before actually using it.

How to display custom marker on map (Gmap + Views)

Build your view listing all your nodes (or just one)

  • Set display to GMAP
  • ​From Format: GMAP Settings change marker handling to By term (for node views)

Drupal Gmap marker handling

Drupal Gmap marker handling

Wasn't so hard, right? 

Now, if you enjoyed this article don' t forget to drop me a comment or alternatively check out these Drupal tutorials on working with Gmap module: