none
Zoom level issue of directionmap RRS feed

  • Question

  • Hi,

    We have one application where we one button to show the direction on different map on same page. We have two map one for main map and other for direction map. When we get the direction for first time from main map then direction map is not zoom to its proper level once we click on Direction button on direction page then it set direction level correctly.

    Thanks!

    Sam 

     
    Saturday, March 19, 2016 2:15 PM

Answers

  • Your screenshot looks like the Bing maps website and not the developer API. Can you provide more details around how your app is using Bing Maps. Are you iframing the consumer site (http://bing.com/maps)?

    http://rbrundritt.wordpress.com

    Saturday, March 19, 2016 10:27 PM
  • In this case the issue is likely that the directions maps view was set when it was collapsed which means that positioning calculations will have values of 0 or infinity. The view should be set when the map is visible, not hidden.

    That said, using two maps will double the cost of using the service and also not a very efficient way to use the API. I recommend using layers (entity collections) to separate your data from the directions. This way you use one map and just switch between the layers. This would use a lot less resources, and generate half the number of billable transactions.


    http://rbrundritt.wordpress.com

    Monday, March 21, 2016 4:31 PM

All replies

  • Your screenshot looks like the Bing maps website and not the developer API. Can you provide more details around how your app is using Bing Maps. Are you iframing the consumer site (http://bing.com/maps)?

    http://rbrundritt.wordpress.com

    Saturday, March 19, 2016 10:27 PM
  • Hi Ricky.

    Here is more details on above issue.

    We have developed application in HTML( not iframing the bing.com). In that we show all pushpins on map(main map object) as shown in below screenshot.

    In above map we select records for which we want direction and clicks on Direction button. On Direction click we have write code to hide main map object and show the direction map and show the route on directionmap.

    We have define two map object one for main map and other is for direction map in HTML page.

    <div id="mainmap"></div>
    <div id="directionmap"> </div>

    And write below code to hide mainmap and show directionmap

    $("#directionmap").show();
    $("#mainmap").hide();

    When we clicks on Direction button to show directionmap in first time then zoom level of route is not set properly. When we clicks again on Direction button then route zoom level set properly.

    Is anything we are missing. Can you please advice.

    Thanks!

    Balasaheb


    Balasaheb

    Sunday, March 20, 2016 7:19 AM
  • In this case the issue is likely that the directions maps view was set when it was collapsed which means that positioning calculations will have values of 0 or infinity. The view should be set when the map is visible, not hidden.

    That said, using two maps will double the cost of using the service and also not a very efficient way to use the API. I recommend using layers (entity collections) to separate your data from the directions. This way you use one map and just switch between the layers. This would use a lot less resources, and generate half the number of billable transactions.


    http://rbrundritt.wordpress.com

    Monday, March 21, 2016 4:31 PM
  • Hi Ricky,

    Ok we will try it using layers. Initially we have tried by using layers but we faced some issues so try using separate map . As we have two panel one for main map and one for direction. Our requirement is to show/hide layer when user switch from main map to direction map. As when we get direction using direction manager we are not able to get the layers. Can you please let us know how we get the direction layers.

    Also for now can we please let us know how to resolve the above zoom level issue. When we use two maps one for direction and one for main map

    Also we just wanted to confirm one thing as we have enterprise license will that affect the billble when we used two maps.

    Thanks!

    Balasaheb    


    Balasaheb

    Tuesday, March 22, 2016 7:27 AM