Chapter 11. Programming with Virtual Earth

Virtual Earth (http://virtualearth.msn.com) is the latest web product from the Microsoft MapPoint team. Even though there are currently no official APIs available, the openness of Virtual Earth allows some friendly “hackability.” Virtual Earth is implemented using a mix of both server-side and client-side technologies, including ASP.NET and AJAX (Asynchronous JavaScript and XML) .

In this section, I want to show you some of the interesting hacks that you can build around Virtual Earth.

Let’s get started!

Warning

This section is based on beta product and undocumented APIs; the APIs and the architecture may change significantly in future versions of Virtual Earth.

Anatomy of Virtual Earth

When you visit the Virtual Earth site at http://www.virtualearth.msn.com, you will see a site that looks similar to Figure 11-1. You will also notice a couple of interesting facts:

  • Map interaction is enabled using the mouse and keyboard.

  • Map interaction does not require a page-refresh.

  • Search, pan, and zoom are preformed asynchronously for a better user experience.

All this is made possible by using JavaScript on the client browser to communicate with the Virtual Earth servers asynchronously. One of the neat things about JavaScript is that you can look at the implementation, since the code exists on the client side. If you look at the source of the Virtual Earth site, you will notice the following JavaScript files:

MapControl.js

Defines ...

Get Programming MapPoint in .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.