none
possible bug in setOptions-maxBound for Bing Maps V8 RRS feed

  • Question

  • Hi,

    I'm getting a 'Uncaught Error: Invalid latitude' error on my FireBug when I issue this instruction:

                var PanningRectLimit = Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(30.691359, -95.862621), new Microsoft.Maps.Location(29.103220, -95.077050));
                map3 = new Microsoft.Maps.Map(document.getElementById("MapPlace2"));
                map3.setOptions({ maxBounds: PanningRectLimit });

    but, if I use the same rect on the map init, works:

                var PanningRectLimit = Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(30.691359, -95.862621), new Microsoft.Maps.Location(29.103220, -95.077050));
                map3 = new Microsoft.Maps.Map(document.getElementById("MapPlace2"), { maxBounds: PanningRectLimit });

    Anyone having the same problem with the 'release' branch of the control?


    Bernardo Salazar


    Thursday, August 18, 2016 4:17 PM

Answers

  • I've tried testing this and it works for me 100% of the time. I've tested against IE11, Edge, Chrome and Firefox. Tested the experimental, release and frozen branches. All of them work. Even tested by loading the map both synchronously and asynchronously. The only possible way I could see this occurring is if you are trying to load the map before the script is loaded, but that would cause issues in both methods of your code.

    [Blog] [twitter] [LinkedIn]

    Thursday, August 18, 2016 5:12 PM

All replies

  • I've tried testing this and it works for me 100% of the time. I've tested against IE11, Edge, Chrome and Firefox. Tested the experimental, release and frozen branches. All of them work. Even tested by loading the map both synchronously and asynchronously. The only possible way I could see this occurring is if you are trying to load the map before the script is loaded, but that would cause issues in both methods of your code.

    [Blog] [twitter] [LinkedIn]

    Thursday, August 18, 2016 5:12 PM
  • Ricky,

    I use chrome for dev purposes, and this strange behavior happens if I set the maxBounds with the setOptions, but commenting out that line, setting the maxBound on the init works. I use the async load, but the control is loaded on the <head> section, so is loaded long before the actual call. Maybe when I issue the setOption (just immediately after the 'new Microsoft.Map') the map is still in the process of the drawing and causes the error?

    PS: I can be reproduce the error anytime, if you are interested to dig a little more on this issue. For now, I just left the maxBound on the map init


    Bernardo Salazar


    Thursday, August 18, 2016 5:30 PM
  • Can you try this against the experimental branch and check to see if you still see this issue.

    [Blog] [twitter] [LinkedIn]

    Wednesday, August 31, 2016 1:23 AM
  • Sorry for the late reply. Loads of work.

    The control still gives me the same error under the experimental branch.

        <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?branch=experimental&callback=loadMapScenario' async defer></script>


    Bernardo Salazar

    Wednesday, September 14, 2016 10:30 PM