How to change Gmap markers color?

user191687 picture user191687 · Nov 15, 2009 · Viewed 19.8k times · Source

I've a custom google map with different points:

Markers[0] = new Array(new GMarker(new GLatLng(45.0, 9.0)), "Location1", "<strong>Address Line</strong><br/>Some information");
Markers[1] = new Array(new GMarker(new GLatLng(45.0, 12.0)), "Location2", "<strong>Address Line</strong><br/>Some information");

etc.

Simply I want to change the color of the markers from the default red. I.E. the 2nd blue.

How to do this?

Answer

rball picture rball · Mar 14, 2010

Use the setImage method on the marker.

Marker[1].setImage('blue-icon.png');

http://gmaps-samples.googlecode.com/svn/trunk/whackamarker/whackamarker.htm