none
Bing Map Ajax V7 - Zoom In/Out Freezes Browser RRS feed

  • Question

  • The issue I am having is when I click on the zoom in/out functionality a couple of times to view the bing map, the browser freezes. This happens in google chrome, firefox and IE11.  

    I'm guessing it is related to the zooming in and out multiple times to view the map. 

    I override the zoomRange to see if I could control the zooming level but that did not fix the issue.

    map.getZoomRange = function() {
                return {
                    max: 12,
                    min: 8
                };
            };

    Is there another setting that I need to check or set in the Bing Map to prevent this issue?  Setting the min and max zoom is the only thing I have found so far but is not working for me.

    Tuesday, September 16, 2014 8:39 PM

Answers

  • I haven't never seen the issue you are mentioning and have just retested it against all the browsers you mentioned and really changed the zoom level fast (300+ times in a minute for 10 minutes). Attempting to override the zoom range like you are won't do anything. The map control doesn't use that method. That method only returns information to people using the developer API and overriding it like you are will only return the new values to you. The map control itself knows that the zoom level range is based on the type of maps being shown. There is no option to override this.

    As for your actual issue, a couple of things worth checking. If you are changing the zoom level programmatically, make sure you are passing in a valid number for the zoom level. If you are also setting the center make sure your latitude/longitude values are valid numbers and not strings. If either of these are invalid it can cause the map to freeze. If this isn't the cause then take a look at what else you are doing with the map. The map itself will not freeze by doing a lot of zooming, there has to be something in your code that I causing this. Are using any map events that are related to the view change? If so, do this trigger a lot of calculations that can cause the page to freeze?


    http://rbrundritt.wordpress.com

    Wednesday, September 17, 2014 8:58 AM
  • I spent a couple of hours testing the code you provided. I wasn't able to reproduce the issue no matter how much I zoomed in/out and no matter how fast or slow I did the zooming and then pressed the link. Every time if works nice and smoothly as expected. I've also tried this on some older browsers as well and it worked perfectly as well. As a final test I tried using an old computer that didn't have much CPU power or memory and it still worked fine. What ever you are seeing is local to your dev environment as I haven't heard of anyone having this issue before and can't repeat it. Have you tried running this code on a different computer?

    Since you have Enterprise licenses you should contact the Bing Maps Enterprise Support team. If you don't have their contact details you can also open up a ticket by pressing the developer support button on the left side of this page: http://www.microsoft.com/maps/Licensing/licensing.aspx


    http://rbrundritt.wordpress.com

    Thursday, September 18, 2014 10:53 AM
  •  I add the code below to dispose of the map when the user leaves our "bing map page" and navigate to another page in our application.  

    This code seem to have fixed the issue.  

    window.onbeforeunload = function() {

    map.dispose();

    }


    PJ

    Thursday, September 18, 2014 10:12 PM

All replies

  • I haven't never seen the issue you are mentioning and have just retested it against all the browsers you mentioned and really changed the zoom level fast (300+ times in a minute for 10 minutes). Attempting to override the zoom range like you are won't do anything. The map control doesn't use that method. That method only returns information to people using the developer API and overriding it like you are will only return the new values to you. The map control itself knows that the zoom level range is based on the type of maps being shown. There is no option to override this.

    As for your actual issue, a couple of things worth checking. If you are changing the zoom level programmatically, make sure you are passing in a valid number for the zoom level. If you are also setting the center make sure your latitude/longitude values are valid numbers and not strings. If either of these are invalid it can cause the map to freeze. If this isn't the cause then take a look at what else you are doing with the map. The map itself will not freeze by doing a lot of zooming, there has to be something in your code that I causing this. Are using any map events that are related to the view change? If so, do this trigger a lot of calculations that can cause the page to freeze?


    http://rbrundritt.wordpress.com

    Wednesday, September 17, 2014 8:58 AM
  • Thanks Ricky for the response.  I do use the new values from overriding the zoom range to programmatically set the zoom level.  So I will validate the number for the zoom level.  I am also setting the center so I will check the latitude/longitude values as you suggested.  

    PJ

    Wednesday, September 17, 2014 3:29 PM
  • I checked the zoom level, longitude, and latitude and the numbers are valid.  

    I have isolated the bing map to just a regular html page with minimal functionality.

    When I click on the zoom all the way in/out(zooming to min and max) a few times(2 or 3 ) and attempt to click on the link called "Bing Link". Then it freezes the browser in google chrome.

     In IE11 it will show the long running script message.  

    Our company has several clients who have bought bing enterprise licenses so I'm trying to figure out what to do next.

    Here is the sample html I used to see if the problem happened outside my code.  

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    .map {

            width: 500px;
            height: 500px;
    }
    </style>
    <script type="text/javascript" charset="UTF-8" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
    </head>
    <body>
    <form>
    <h2>Bing Test</h2>
    <br/>
    <a href="http://www.bing.com">Bing Link</a>
    <br/><br/>

    <div id="mapDiv" class="map"></div>

        </form>
        <script type="text/javascript">
              var map = null;
              map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), { credentials: BingMapKey }  );
         </script>
    </body>
    </html>


    PJ


    Wednesday, September 17, 2014 8:41 PM
  • I spent a couple of hours testing the code you provided. I wasn't able to reproduce the issue no matter how much I zoomed in/out and no matter how fast or slow I did the zooming and then pressed the link. Every time if works nice and smoothly as expected. I've also tried this on some older browsers as well and it worked perfectly as well. As a final test I tried using an old computer that didn't have much CPU power or memory and it still worked fine. What ever you are seeing is local to your dev environment as I haven't heard of anyone having this issue before and can't repeat it. Have you tried running this code on a different computer?

    Since you have Enterprise licenses you should contact the Bing Maps Enterprise Support team. If you don't have their contact details you can also open up a ticket by pressing the developer support button on the left side of this page: http://www.microsoft.com/maps/Licensing/licensing.aspx


    http://rbrundritt.wordpress.com

    Thursday, September 18, 2014 10:53 AM
  •  I add the code below to dispose of the map when the user leaves our "bing map page" and navigate to another page in our application.  

    This code seem to have fixed the issue.  

    window.onbeforeunload = function() {

    map.dispose();

    }


    PJ

    Thursday, September 18, 2014 10:12 PM