Virtual Earth-What's New in the Latest Release (Cont.) New Tile Set-Hill Shaded The core imagery of Virtual Earth is broken into tile sets, these 256 x 256 px images are loaded on demand in both the 2D AJAX control and the 3D control. “Hill Shaded” is a new tile set that combines the lightweight, easy-to-read road tiles with a 3D shading effect based on the elevation data, see Figure 6. The result provides an alternative to the existing “Hybrid” tile set which provides the road information over the satellite and aerial photography available in the “Aerial” tile set. To switch to the new shaded tiles, use the new enumeration value in the map load or call:  Figure 6: The new Hill Shaded tiles in Virtual Earth.map.SetMapStyle(VEMapStyle.Shaded);
With this addition you now have four tile sets, as well as the unique bird’s eye images and textured 3D models making up the imagery of Virtual Earth. Prefer to Zoom to the Mouse Pointer? A new option for navigating Virtual Earth is to change from the default, where the mouse scroll wheel zooms on the center of the screen, to a mode where Virtual Earth will zoom on the mouse location itself. It can be a little counter-intuitive at first as this functionality was previously reserved for a “double click” on the map. It does however, with a little practice, allow for a click-less zoom to any point on the planet. It is enabled with one line of code: map.SetMouseWheelZoomToCenter(false);
Shapes Get Faster and Some New Methods Also Shapes are interactive elements you can add to your map. These include: - Pushpins: representing a single point.
- Poly lines: representing a path of many points.
- Polygons: representing a closed area of points.
Zindex You can now change the “Zindex” of shapes. As shapes can easily overlap, it is important to be able to control which shape appears on top or behind. This is the same concept as in applications like Microsoft PowerPoint, where you may send objects backwards or forward in their Z index. Microsoft has added three new methods to retrieve and set Zindex for the icon (pushpin) and the line or polygon separately, collectively called the “polyshape”. VEShape.GetZIndex(); VEShape.GetZIndexPolyShape(); VEShape.SetZIndex(icon, polyshape);
Altitude Within 3D mode, you can now position shapes at a specific altitude. The VELatLong class now has two extra properties: VELatLong.Altitude VELatLong.AltitudeMode
The Altitude is a floating point number while the Altitude Mode is an enumeration supporting the following options: - Absolute: the altitude is meters above the WGS 84 ellipsoid.
- RelativeToGround: the altitude is meters above ground level (default).
This opens up a world of possible visualizations within 3D mode for anything above the ground. You may have already seen some great applications tracking aircraft online. | " | Clearly it is uncommon to actually know these coordinates unless the data is coming from a GPS device.
| " |
Polygons and Poly lines also get a new method to draw a line to the ground from the shape at altitude. This also opens up some interesting visualization options: VEShape.SetLineToGround(extrude);
Conditional Zoom Level Range It is a common issue with Virtual Earth that as you zoom out, shapes overlap. You have already seen how you can adjust the Zindex, but it is also now possible to hide shapes. Two new methods allow for the specification of a maximum and minimum zoom level to show the shape: VEShape.SetMaxZoomLevel(level); VEShape.SetMinZoomLevel(level);
This allows you simply to hide some or all of the shapes or provide additional shapes at other zoom levels to represent the density. Reduction of Polygon / Poly Line Accuracy Enabled by default, Virtual Earth will now remove points within a polygon or poly line that are very close visually given the current zoom level. The concept is to reduce the complexity of these objects to improve performance, for example when a 1000 point polygon over New York is viewed at the country level it only needs a few points or, in fact, is too small to render at all. You can disable this new performance feature with the following code: map.EnableShapeDisplayThreshold(false);
Performance of Bulk Add The Virtual Earth team has made a significant performance improvement for the addition of many pushpin shapes to the map. The simple change allows an array of shapes to be added in the existing function: VEShapeLayer.AddShape(Array);
The performance increase is very measureable; Table 2 shows performance improvements of using the bulk method over a loop of single AddShape() calls. It is a simple change to most existing applications to benefit from this. Rather than adding directly to the map, add your shapes to an array, and then add this array of shapes to the map in one call. Map Cruncher Is Now Part of the Virtual Earth Platform The core of Virtual Earth is accurate image tiles representing the Earth in several different formats. The system allows the user to “stream” just the images they require as they pan and zoom around the planet. This provides the fluid experience and fast load times for such a massive set of data. A powerful feature is the ability to add your own tile layers on top of the map. This allows for the same highly scalable performance for your data overlay or additional imagery for your application. | " | Rather than add directly to the map, add your shapes to an array, and then add this array of shapes to the map in one call.
| " |
Map Cruncher is a tool that imports raster-based and vector-based images, provides an interface to align the images directly with Virtual Earth, and outputs the tiles in the correct format and naming convention for use with the control. Figure 7 shows Map Cruncher in action. You can also run Map Cruncher from the command line.  Figure 7: MapCruncher Beta in action.Import Your Data Here Lastly Virtual Earth now supports the import of the common XML format KML or “KeyHole Markup Language”. The process to import is identical to the existing GeoRSS or a Live collection import types; Microsoft added a new enumeration: VEDataType.ImportXML. var spec = new VEShapeSourceSpecification(VEDataType.ImportXML, "http://enteryourkmlurlhere.htm"); map.ImportShapeLayerData(spec);
Unlike GeoRSS, the KML file itself must be located on a publicly accessible Web server, not a local file or localhost, as the data is parsed through maps.live.com. Conclusion Virtual Earth has grown into a mature application ready for use in demanding enterprise applications. The recent update added new functionality, improved the user interface, and increased the performance while having no breaking changes. Applications using version 5 may simply need to change the version number to 6. However to support this, certain functionality from previous versions, such as the old routing method, still works but has been marked as deprecated: - VEMap.GetRoute: use VEMap.GetDirections instead.
- VERouteDeprecated: old VERoute class.
- VERouteItineraryDeprecated: old VERouteItinerary class.
Now is the perfect time to update your Virtual Earth applications to the latest version or begin using this exciting technology to visualize your location-based data in your application. John O'Brien |