如何在Google Map中更改标记的颜色?

Don*_*eak 3 google-maps

我不会使用GIcon更改标记.还有其他方法可以更改标记的颜色???

Red*_*ing 8

不,如果你不想自定义你的标记,你需要使用GIcon.

您可以在Google地图图标项目中找到大量免费标记.使用自定义标记的代码非常简单:

// Create our "tiny" marker icon
var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";

// Set up our GMarkerOptions object
markerOptions = { icon:blueIcon };

// add the markerOptions as the second param to GMarker constructor
map.addOverlay(new GMarker(latlng, markerOptions));
Run Code Online (Sandbox Code Playgroud)