0
votes

I create Bing Maps AJAX control and initialize it with always the same values: lat, lng and zoom level. This is a default aerial map type and a maximum zoom level. And every time I get the following image:

http://i50.tinypic.com/acturr.jpg

There is no documented method (or not) to refresh the current area so I should to do zoom out and zoom in using mouse every time, it's annoying. For Google Maps I found a useful trick:

google.maps.event.trigger(this.map, 'resize');

Does Bing Maps AJAX API have something similar?

1
Then why not just switch to Google Maps API? (from my experience, their documentation and overall API structure is far better than Bing's) - Kerstomaat
Can you maybe post some code of what you do, and a live demo (jsFiddle) would be very handy as well to demonstrate the problem. - Styxxy
I'm sorry but in this case it is useless. jsfiddle.net/Jd7pN there is a simple example but sometime I see a picture above instead of proper trees and road. It occurs in IE 8,9 or inside its WebMap COM control. Probably it is because of bad connections, I often see not properly loaded tiles, anyway it does not matter. Google has a way to just refresh control. I would like to have such stuff for Bing. - KneLL
did you get any solution for bing map? - Brune

1 Answers

1
votes

I have recently encountered a similar issue on Bing maps AJAX V7:

On some browsers (Mostly on Chrome), if the map is not present on the viewport (you have to scroll to reach it), then it initializes improperly. I have reported the issue to MSDN but didn't get any useful answer: https://social.msdn.microsoft.com/Forums/en-US/439c33bc-a1ed-4e74-a019-f7fecb809030/scroll-issue-on-chrome-with-ajax-v7-control

To fix this issue, I have used two things:

  • First of all, I had to find a way to force the Bing map to refresh (didn't found any solution on the internet nor object method to do that). After a lot of tests I came out with a solution:

    map.setMapType(Microsoft.Maps.MapTypeId.mercator);
    setTimeout(function(){map.setMapType(Microsoft.Maps.MapTypeId.auto);}, 1)
    

    Indeed, changing the viewport to "mercator" then back to another forces the map to refresh (the setTimeout makes the action asynchronous)

  • I then have added a lib that triggers an event when an element is entering the viewport in order to trigger the force refresh every time the map enters the viewport