添加多个标记到 Google 地图
有人知道如何在单个谷歌地图上添加多个标记吗?我正在谷歌搜索这个,但进入JavaScript,我正在使用GWT
Does someone know how to add several marker on a single google map, I am googling this but getting in JavaScript, I am working with GWT
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这个链接怎么样 http://code.google.com/p/gwt -google-apis/wiki/MapsGettingStarted
页面中间有一个示例:
// 添加标记
map.addOverlay(新标记(cawkerCity));
How about this link http://code.google.com/p/gwt-google-apis/wiki/MapsGettingStarted
In the middle of the page there is an example:
// Add a marker
map.addOverlay(new Marker(cawkerCity));
编辑:抱歉刚刚看到了 javascript 部分。请发布一些代码以及您正在使用的 api,以便我们可以更清楚地检查这个问题
假设您使用的是 javascript api v3,您应该检查 用于添加标记的文档。希望这有帮助
Edit:Sorry just saw the javascript part.Please post some code and what api you are using so we can examine this question more clearly
Assuming you are using javascript api v3 you should check the documentation for adding markers.Hope this helps
只需将其粘贴到创建地图的代码之后(在名为“map”的变量中):
simple paste this after code which creates your map (in variable named 'map'):
这里有两个函数可以完全满足您的需要(addMarker、loadTestData)。当您加载地图 api 时,在“onModuleLoad”内部调用它们。另外,您可能希望使用“MarkerOptions”作为工具提示和图标。下面的代码可以,但您不必这样做。
Here's two functions that do exactly what you need (addMarker, loadTestData). Call them inside of "onModuleLoad" when you load the maps api. Also, you may want to make use of "MarkerOptions" for tooltips and icons. The code below does, but you don't have to.