Virtual Earth Tiles

I have been working with Virtual Earth some more. I wrote recently about the tiles that make up the map image and have made some new discoveries.

When you create a new map, the tiles collection has the tiles in the order of their placement in the grid, by column, as opposed to by row, like a <table> object builds a grid. So in a map of 12 tiles, map.tiles[0] through map.tiles[11] are placed like this.


However as you pan (scroll) around the map image, VE just keeps adding tiles to the end of the collection based on your movement. Therefore, when you stop scrolling, the tiles will no longer be in any order that you can count on, which is not good if you have code depending on the above order.
To rectify this you can use two methods of the map control to jiggle the tiles back into “proper order”.
Capture the onEndContinusPan event of the map and then use the SetCenter method followed by the _UpdateMap method.

map.onEndContinuousPan = function(e)

I had originally tried to just create a new map when the panning ended, but I was unable (by hook or by crook) to get the compass control, zooming controls, etc to interact with the new map.
Thanks to ViaVirtualEarth for the lesson on how to capture map events.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.