Friday, December 9, 2011

Creating a custom google maps marker with canvas

Generating a custom marker with canvas is handy when you want to change the marker size/color dynamically.

The following code snippet contains a 'createMarker' function that creates a canvas, draws the marker graphics and returns back the Data URL encoded version of that canvas which can be used as an input at the marker creation.

See the example below.

1 comment:

  1. hey, thanks for this. i found it very helpful. i am designing a map site that uses markers to show rain totals for particular regions. This works great.

    ReplyDelete