开发者

can't add a custom marker to Google maps ( JS )

Was wondering, how do I add a custom marker to google maps, JavaScript, integrated into my site.

This code adds a regular marker:

var marker = new 开发者_Go百科GMarker(center);
map.addOverlay(marker);

but where do I insert an image tag (say, "marker.png" ) for it to appear instead of the regular google marker?

Thanks!


You may be interested in the Google Maps documentation page about custom icons. In particular, see this line in createMarker:

letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

You should be able to replace that with your own image. More info on GIcons is in the API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜