【问题标题】:Bing Map Route API : Route point showing lat, long not addressBing Map Route API:显示纬度的路线点,长不是地址
【发布时间】:2018-06-08 03:36:00
【问题描述】:

当点击网格项目时,我通过 lat 和 long 来获取源和目的地以及地图上的路线显示。

但每次我在 [A] 和 [B] 路线点而不是地址上看到纬度和经度。

那么如何在 [A] 和 [B] 点而不是 lat, long 上显示地址?

以下是我的代码。

Microsoft.Maps.loadModule('Microsoft.Maps.Directions', () => {

      that.directionsManager = new Microsoft.Maps.Directions.DirectionsManager(that.map);
      that.directionsManager.clearAll();
      // Set Route Mode to driving
      that.directionsManager.setRequestOptions({
        routeMode: Microsoft.Maps.Directions.RouteMode.driving
      });

      that.directionsManager.setRenderOptions({
        drivingPolylineOptions: {
          strokeThickness: 3
        }
      });

      const waypoint1 = new Microsoft.Maps.Directions.Waypoint({
        location: new Microsoft.Maps.Location(that.truckData.currentLat, that.truckData.currentLong)
      });

      const waypoint2 = new Microsoft.Maps.Directions.Waypoint({
        location: new Microsoft.Maps.Location(that.truckData.workLat, that.truckData.workLong)
      });

      that.directionsManager.addWaypoint(waypoint1);
      that.directionsManager.addWaypoint(waypoint2);

that.directionsManager.calculateDirections();

【问题讨论】:

    标签: bing-maps


    【解决方案1】:

    如果您想显示其他内容而不是坐标,请将其传递到航点的地址属性中,如以下代码示例所示:https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/directionscreatedrivingroute

    【讨论】:

    • 感谢瑞奇的回复。我已经看到了这个链接。我担心的是我只有源和目的地的纬度和经度可用于在地图上获取路线。这就是为什么 [A] 和 [B] 只显示了这一点。我没有来源和目的地的直接地址。
    • 在这种情况下,您有两个选择;一种是在计算路线之前对坐标进行反向地理编码。另一种是隐藏航点,向路线管理器添加路线更新事件,然后根据返回的路线信息为航点创建图钉。
    • 感谢您的建议,我已经尝试过反向地理编码方法,但我得到了太多延迟,并且由于该路线仅显示经纬度。我认为可能有一种方法可以从路由 api 获取地址。
    猜你喜欢
    • 2012-10-09
    • 1970-01-01
    • 2016-06-06
    • 2011-12-09
    • 2012-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-24
    相关资源
    最近更新 更多