Virtual Earth 101

Find out how to use the Virtual Earth AJAX Map Control and the Windows Live Tools for Visual Studio to add sophisticated mapping features to your web applications.

by Jim Duffy

Mar 23, 2009

Page 1 of 4

read somewhere that nearly 80 percent of all data has some location-related aspect. Some examples of common location-related data questions might include:

Where do we ship these orders?

Where are flood plains located, and what rainfall amounts are problematic for them?

Where are vendors and/or customers located?

What delivery route should we use?

Can we track shipments using GPS?

Where are voting districts located?

Where are the best hospitals located?

Where are the sales regions that produce the most revenue?

And so on. It's highly likely that a significant portion of the data you work with has a location-related aspect as well. Presenting this information visually could lead to better management decisions or even possibly uncovering trends that were not previously evident. A good application can present this information using a location-oriented approach. That's where Microsoft Virtual Earth fits in.

This article aims to start you on your way developing applications with Virtual Earth, and get you thinking outside the box regarding the way you display information to your web site visitors or your corporate management.
For example, consider a postal code sales report sorted in descending order by sales percentage. Maybe you could improve upon that report by presenting the data as a pie chart to help management see how specific postal codes compare to each other. Taking that idea even further, you could overlay that same information on a map, which reveals that the top three postal codes are all on one side of a particular highway. Maybe that's important, maybe it's not—but that fact would go unnoticed on a report or a pie chart. Geographically visualizing data takes the analysis to an entirely new level.

Virtual Earth makes it easy to get started developing location-based applications, but first you'll need to decide which technology you want to use. You have two choices. One uses the Virtual Earth AJAX Map Control, where all the coding is done in JavaScript. The AJAX Map Control's primary advantage is that it's platform independent. Though it works in ASP.NET, it doesn't require ASP.NET. You can use it on any web development platform.
The other option uses the ASP.NET Map Control contained in the just released Windows Live Tools for Visual Studio November 2008 CTP. The ASP.NET Map Control's advantages are that you can control it via managed code (Visual Basic, C# or any .NET language) and it substantially reduces or totally eliminates the amount of JavaScript code you need to write.
So should you choose managed code or JavaScript? I don't know about you, but I'll go with managed code every time. However, this article shows examples of both.

But I'm getting ahead of myself. Let me back up and start with an answer to the question, what is Virtual Earth?

What Is Virtual Earth?

Virtual Earth is a group of services from Microsoft that provides a high-quality geospacial data and imagery platform for you to work with. Unfortunately that sounds like a Microsoft definition. What that really means is that Microsoft provides developers with a platform, API, and other tools for visualizing data on a map. That data could be something as simple as pushpin points indicating where retail stores are located, or lines connecting points, or polygons covering a geographic area, or a combination of all three.

Virtual Earth allows you to add content in several ways. You can add points, lines, and polygons via code, or you can import data from other locations such as GeoRSS feeds, Keyhole Markup Language (KML), or GPS eXchange (GPX) files. The examples first show how to add content to a map using code, and then move on to importing data from a GeoRSS feed.
The Virtual Earth platform consists of a number of features, including: imagery, buildings, geocoding, Yellow Pages and points of interest (POI), traffic, search and proximity, routing and directions, 3D models, and more. These features are delivered by two separate but complimentary pieces: the Virtual Earth AJAX Map Control and (new to version 6.2), Virtual Earth Web Services 1.0.