【问题标题】:Displaying route details from direction render marker in Google map v3在 Google 地图 v3 中显示来自方向渲染标记的路线详细信息
【发布时间】:2012-03-22 21:16:55
【问题描述】:

我尝试在 Direction 生成的相应 infoWindow 中显示路网信息

渲染标记。例如,单击信息窗口时标记 A 包含从 A 到 B 的所有详细信息。

此外,在源和目的地之间显示了一组航点。

信息不显示在 InfoWindow 弹出窗口中。这是代码的一部分。任何提示都可能

帮助谢谢。

directionsService.route(request, function (response, status) {

            if (status == google.maps.DirectionsStatus.OK) {

            var roadInfo = document.getElementById("directionsPanel");

            roadInfo.innerHTML="<b>"+response.routes[0].roadInfo+"</b>";

                directionDisplay.setDirections(response);

            var myRoute = response.routes[0].legs[0];
                google.maps.event.addListener(request, 'click', function() {
                // Open an info window when the marker is clicked on,

                // containing the text of the step.

                displayStep.setContent(request,myRoute.steps[i].instructions);
        });

【问题讨论】:

    标签: google-maps-api-3 driving-directions


    【解决方案1】:
    1. 请求没有点击事件,当您单击标记时看到的 infowWindow 是由 directionRenderer 强制的,您无法控制标记和 infoWindows,您唯一能做的就是抑制他们
    2. 路线没有 roadInfo

    您可以做什么:取消标记和 infoWindow 并创建您自己的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-15
      • 1970-01-01
      • 2014-06-06
      相关资源
      最近更新 更多