How to add a custom marker icon on gmap using the gmap module?
You do not really need to write your own module (unless it does something out of the box) in order to use custom markers.

Here is an guide how you can do that (I assume we use gmap module and views module to display google map.


Upload you custom markers to Drupal website, f.x. to your theme folder (i.e. /sites/all/themes/yourtheme/images/markers or another location that suit you more.
In that folder you need to create an INI file and declare your custom markers (give them name etc). See example with 1 custom marker below.

Go to gmap settings /admin/config/services/gmap and specify folder where you saved your marker image and ini file (see image below).

Now make sure you saved everything and cleared cache.
Go to your view and in the settings you must get your custom marker available (at the bottom).