0

我是 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>
4

1 回答 1

1

如果您使用 Maps Engine 图层来渲染数据,则信息窗口将根据您在 Maps Engine 中的图层设置进行渲染。您可以使用普通的旧链接为用户提供方向(和奖励,在移动设备上它将在本机应用程序中打开)。

像这样的 URL 将提供从“当前位置”(地图将解释为用户的位置)到提供的 lat/lng 的路线:https ://www.google.com/maps/dir/Current+Location/43.12345,- 76.12345

Maps Engine 的信息窗口字段也可能有所帮助:https ://support.google.com/mapsengine/answer/2984965?hl=en

本文中有关地图链接的更多信息:http: //gearside.com/easy-link-to-locations-and-directions-using-the-new-google-maps/

于 2014-08-28T04:36:03.153 回答