【发布时间】:2014-07-24 20:42:08
【问题描述】:
我是 Google Maps Dev 的新手,需要您的帮助。我正在使用谷歌地图引擎通过 CSV 文件加载数据,这有助于自动对地址进行地理编码。创建新图层并在地图上填充它们后,我在我的地图应用程序(JSv3 API)上调用 Map 和 LayerI.D。当我单击标记时会弹出信息窗口,并且我希望在信息窗口上有方向(功能)链接。有没有一种方法可以像我们在一般的谷歌地图搜索上一样在信息窗口上提供方向服务。 我的代码如下所示。
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=###############">
</script>
<script type="text/javascript"src="http://maps.googleapis.com/maps/api/js?libraries=visualization&key=##############"></script><script type="text/javascript">``function initialize(){var mapOptions={zoom: 5,center:new google.maps.LatLng(42, -99)};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var mapsLayer = new google.maps.visualization.MapsEngineLayer({
mapId: '131467379863959',
layerKey: 'layer_00001',
map: map,
suppressInfoWindows: false,
clickable: true
});
var mapsLayer2 = new google.maps.visualization.MapsEngineLayer({
mapId: '13146737986395',
layerKey: 'layer_00002',
map: map,
suppressInfoWindows: false,
clickable: true});}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
【问题讨论】:
-
您有什么尝试过的吗? 有没有办法:有
-
Example of adding directions to the infowindow of a marker(从Mike Williams' Google Maps Javascript API v2 tutorial转换为Google Maps Javascript API v3)
-
@Dr.Molle 我尝试过使用 APIv3 Directions 服务,但它出现在地图上。我希望在信息窗口上有路线链接。
-
@geocodezip 我正在使用 APIv3,教程显示这些方法已被 Google 拒绝。有没有其他方法可以实现这一点。
-
有很多方法可以实现它。你看过我的例子吗(不是 Mike 的教程)?
标签: javascript google-maps google-maps-api-3 google-maps-engine