Custom markers

You can add custom markers to GMap by placing the marker images in the markers/ directory, and configuring the marker with an ini file. You may wish to make your own folder to keep your markers seperate from the built-in markers.

An ini file:

; Defaults
[defaults]     ; The defaults section holds the settings that will be used if they are not specified on the marker.
;shadow = ""   ; The filename of the image to use for the "shadow" of the marker.
anchorX = 10   ; anchorX and anchorY are the pixel coordinates relative to the top left corner of the image
anchorY = 29   ; to define where the "pushpin" of the marker is.
infoX = 17     ; infoX and infoY are the pixel coordinates relative to the top left corner of the image
infoY = 6      ; to define where the "tail" of a popped-up info window points to.

; Marker sets
[mycustom]                    ; This is the "internal" name of the new marker type. It's used
                              ; in macros and when placing markers using PHP code.
name = "My custom"            ; This is the name that appears in the marker chooser dropdown.
sequence = "my1.png,my2.png"  ; The list of image files to use. Specifying multiple filenames
                              ; will let you have changing images when placing a series
                              ; of markers. The "Numbers" marker is a good example.

; Files

After creating your .ini file, be sure to go to the GMap settings page and click the Regenerate button.

GMap hooks

(TODO)

Adding behavior flags

(TODO)

Javascript handlers

(TODO)

GMap uses a custom event system to pass data and events around.

To use this handlers create a js file and use insert this example code. This example prints a alert, everytime a user clicks on a marker.

  // Add a gmap handler
  Drupal.gmap.addHandler('gmap', function(elem) {
    var obj = this;
    obj.bind('zoom', function() {
      var zoom = obj.vars.zoom;
      alert('user zoomed');
    });
  });

Extending GMap Views

(TODO)