Improving the performance of drawing large vector datasets on the Virtual Earth map.

One of the topics that comes up often when I give Virtual Earth programming talks is that there is a point where performance degrades when adding shapes (pushpins, polylines, polygons) to the map.  When depends on the complexity of the shapes you add.  I always go on to explain that this is not 100% a limitation of the map control as much as it is a limitation of the fact that the control is an JavaScript control.  Therefore, we are at the mercy / limitations of JavaScript in the browser.  The recommendations I usually make are:

  • You as the developer need to manage the shape objects on the map.  Only show what’s necessary in your given view.  For example, if you are looking at a map of the united states, don’t try to draw county polygons for a given state.  Only draw county polygons when you have zoomed in to a level where it would make sense.  After you have zoomed in, you need to clear any polygons outside the current map view.
  • I agree that the first approach takes requires an extra a bit of client side coding to manage shapes.  Another approach is to generate tiles on the server and overlay those tiles on the existing map, effectively drawing vectors in a much more efficient manner without having to creating a huge amount of JavaScript objects.  Johannes Kebeck has some great articles on how to go down that path.  I have links to the articles in my working list of Virtual Earth Resources.  Another approach is to use a third party solution like MapDotNet Server 2007 to do the heavy lifting for you.  If you are interested, check out their Interactive SDK and samples.

If using something like MapDotNet isn’t an option for you and you need to go down the "do it yourself" path, then you’ll want to check a post from Keith Kinnan I just came across titled Microsoft Research Releases Tiled Vectors Demo.  There’s some great information and code samples for you "doityourselfers."

Technorati Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s