Google 地图:显示标记的本地图像
如何显示 GMarker 的本地图像?我正在使用 v2.代码示例
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);
它不起作用...
How do I show 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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
地图页面的本地内容是 Google 地图网站本身,因此如果您想使用网站中的图像,则必须提供其完整的 URL。
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.
如果您还没有看过 v2 文档,请参阅以下链接:
http://code.google.com/apis/maps/documentation/javascript/v2/overlays.html#Custom_Icons
另外,您是否确实将其添加到地图中,或者是否从代码中省略了它?
以下是完整示例:
http://code .google.com/apis/maps/documentation/javascript/v2/examples/icon-simple.html
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