开发者

Google Maps: showing a local image for a marker

How do I show 开发者_JAVA百科a local image for a GMarker? I am using v2. Code sample

var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image = '/Images/marker/mr.png';
markerOptions = { icon: blueIcon };

map.setCenter(point, 3);
var marker = new GMarker(point, markerOptions);

Its not working...


What's local to the map page is the Google Maps site itself, so if you want to use an image from your site, you have to provide the full URL for it.


If you haven't seen the v2 docs, here is a link:

http://code.google.com/apis/maps/documentation/javascript/v2/overlays.html#Custom_Icons

Also, are you actually adding it to the map, or have you omitted that from your code?

Here is a full example:

http://code.google.com/apis/maps/documentation/javascript/v2/examples/icon-simple.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜