0

When click on grid item, I pass lat and long for source and destination and route display on the map.

But everytime I see latitude and longitude on [A] and [B] route point instead of address.

So how to display address on [A] and [B] point instead of lat, long ?

enter image description here

Following is my code.

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();
Pushkar Rathod
  • 353
  • 2
  • 7
  • 26

1 Answers1

0

If you want something else to display instead of the coordinates, pass it into the address property of the waypoints as shown in this code sample: https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/directionscreatedrivingroute

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
  • Thank Ricky for reply. I already saw this link. My concern is I have only latitude and longitude for source and destination available to get route on the map. And that's why [A] and [B] is showing that only. I don't have direct address for source and destination. – Pushkar Rathod Jun 07 '18 at 20:34
  • In that case you have two options; one is to reverse geocode the coordinates before calculating the route. The other is to hide the waypoints, add a directions update event to the directions manager, then create pushpins for the waypoints based on the returned route information. – rbrundritt Jun 08 '18 at 19:43
  • Thanks for suggestion I already tried reverse geocode approach but I am getting too much delay and due to that route is getting displayed with lat long only. I thought there might be a way to get address from route api. – Pushkar Rathod Jun 12 '18 at 18:18