ow in its sixth major release, Virtual Earth offers an entire world of opportunities for innovative web-based mapping. Whether you sell real estate, track assets, need a store locator, or simply have some data you want to map, Microsoft Virtual Earth is ready to provide a stable, high-performance, accurate, and engaging web-based experience for your clients.
shows a basic "Hello world" 2D example.
Virtual Earth code development is not tied to any server side technology. As demonstrated in Listing 1
New Navigation with a New Default Dashboard
The new navigation dashboard (see Figure 1
) provides all the default navigation functionality, including zooming, panning, and changing map styles and map modes. Revamped in nearly every version so far, the latest control has a minimalist look and a smaller download footprint. Users can minimize the control if they need more screen real estate for their current map application.
|Figure 1. The Default Virtual Earth Dashboard: The default dashboard provides basic navigation functions.|
VE has three built-in dashboards you can choose from. You can also turn off VE's dashboards completely and create your own. To change to a different built-in dashboard, you set the dashboard before you load the map as follows:
Photosynth-Style Bird's Eye Images in 3D
map = new VEMap('myMap');
The bird's eye images within Virtual Earth are truly amazing. These are oblique images taken from a low angle that provide high-resolution images of all four sides of a scene. Popular with real estate applications, these images compliment the familiar straight-down orthogonal images, providing far more location detail than simply looking at rooftops.
Incorporating these images in 3D mode is a new feature in Virtual Earth. With an interface style directly based on the upcoming Microsoft Photosynth
, users visually select high-resolution scenes to be loaded into the 3D space. When combined with the existing (and ever-expanding) 3D models, the photosynth feature provides developers with an innovative experience to use in their own applications. Figure 2
shows a bird's eye scene loaded over a set of 3D buildings in New York. Note the outline of surrounding images easily selectable by the user.
|Figure 2. Photosynth Image: The figure shows Photosynth-style navigation of bird's eye images in Virtual Earth 3D.|
|Author's Note: Here's a tip: Use the keyboard arrow keys and the dashboard rotate buttons to navigate between the photosynth images seamlessly. You can preview this amazing functionality at http://maps.live.com.
Developers get two new bird's eye methods in the traditional 2D mode. The first is GetBoundingRectangle()
This method returns an oversized approximation of the bounds of the current scene, which is perfect if you need to query for data within the current scene. For example, you could use the bounding latitude and longitude values returned from this method to query a database for records that lie within this bird's eye scene, thus loading the records for display in Virtual Earth on demand, and improving your application's performance.
Unfortunately, due to licensing restrictions, you cannot access exact latitude and longitude values from bird's eye images.
The second method is:
This method lets you request a bird's eye scene based on a latitude/longitude coordinate and zoom level.
To facilitate highly accurate shape placement within bird's eye scenes, Microsoft has added several new methods. Firstly, you can configure a "shapes accuracy" policy using the method VEMap.SetShapesAccuracy(policy)
. The options are:
- None: No shapes are accurately converted (default).
- Pushpin: Only pushpins are accurately converted.
- All: All shapes are accurately converted.
Secondly, you can configure the number of shapes to convert accurately using VEMap.SetShapesAccuracyRequestLimit(number).
The default is 50
. This process is slow, so you should use it only where absolutely required.
|Editor's Note: This article was first published in Code Focus magazine, and is reprinted here by permission.|