none
Bing map v8 print map RRS feed

  • Question

  • By using version 7 of bing map, I could able to print the direction (both in text and in map path) as below. How to achieve this by using bing map v8?

    Friday, June 30, 2017 8:49 PM

Answers

All replies

  • You would do this the same way in v8 as v7.

    [Blog] [twitter] [LinkedIn]

    Saturday, July 1, 2017 4:19 AM
  • The e.containerElement was not part of the documented V7 SDK. Note that you should already know the element since you have to specify where you want the output to be rendered.

    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Wednesday, July 5, 2017 7:36 PM
    • Marked as answer by saumyadas Wednesday, July 5, 2017 11:18 PM
    Wednesday, July 5, 2017 7:36 PM
  • When we set the start and end address to get the direction, we get a list of itinerary in e.route[] object. The detail of the route should be displayed based on the user selection. How to find the the selected  itinerary  index to get the details from e.route array? Lets say I have 3 itineraries for my start and end address. Suppose user selects the 2nd one, how in my code I'll track which one user has selected. In this example, it's the 2nd one. Once I find this one, I can get the details from e.route[2] object.

    Thanks!

    Thursday, July 6, 2017 3:08 PM
  • In the directions updated event handler use the directions managers getCurrentRoute function. This will provide you with the route information of the route selected by the user. https://msdn.microsoft.com/en-us/library/mt750375.aspx

    [Blog] [twitter] [LinkedIn]


    Thursday, July 6, 2017 3:54 PM
  • To print the map image in v7, I was using the below to get the map image and used it  as a source to load the map again in a different page and print. I was showing only one itinerary.

    bingMap.getCredentials(makeImageryRequest);

    function makeImageryRequest(credentials) {
        var url = null;
        if (imageryOptions.showRoute) {
            url = "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?ms=" + imageryOptions.imageWidth + "," + imageryOptions.imageHeight + "&wp.0=" + imageryOptions.startAddress + "&wp.1=" + imageryOptions.endAddress + "&key=" + credentials;
        }
        else {
            url = "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/" + imageryOptions.startAddress + "?ms=" + imageryOptions.imageWidth + "," + imageryOptions.imageHeight + "&pp" + imageryLat + "," + imageryLng + ";35;A&key=" + credentials;
        }

        imageryOptions.callBack(url);
    };


    How to print the map image in v8 for the SELECTED itinerary(out of multiple itinerary)? In other words, Is there any function/url we can use to get the map image of the user selected itinerary?

          

    • Edited by saumyadas Thursday, July 6, 2017 8:03 PM
    Thursday, July 6, 2017 6:34 PM
  • That code is using the Bing Maps REST services, not Bing Maps V7. No need to change it.

    [Blog] [twitter] [LinkedIn]

    Friday, July 7, 2017 12:50 AM
  • The above code works if we have one itinerary as it fetches the map route image based on the start and end address. How to print the map with route for selected itinerary (out of multiple itinerary) for the same start and end address? What extra parameter I need to pass to REST service to identify which itinerary  user has selected or Is there any equivalent to getCurrentRoute  function to get the current map image?





    • Edited by saumyadas Friday, July 7, 2017 4:14 PM
    Friday, July 7, 2017 2:08 AM
  • The REST static imagery service only provides access to the first calculated route, not alternate routes. Documentation for this service can be found here: https://msdn.microsoft.com/en-us/library/ff701724.aspx

    If you want the experience of your map to align with what the REST service supports, you can set the maxRoutes option in your V8 code to 1. 


    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Friday, July 7, 2017 5:42 PM
    • Marked as answer by saumyadas Monday, July 10, 2017 2:24 PM
    Friday, July 7, 2017 5:42 PM