Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Virtual Earth—What's New in the Latest Release : Page 4

Microsoft's web-based mapping application has an upgraded user interface, better compatibility, and improved functionality, so it's an ideal time to get started with the platform or upgrade your existing application. Find out what's new and what's changed in the latest release.


advertisement
New Tile Set—Hill Shaded
The core imagery of Virtual Earth is broken into tile sets; both the 2D AJAX control and the 3D control load these 256 x 256 images on demand. The "Hill Shaded" set 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. Hill-Shaded Tiles: The hill-shaded tile set supports viewing elevation in Virtual Earth.

map.SetMapStyle(VEMapStyle.Shaded);

This addition makes four tile sets available, as well as the unique bird's eye images and textured 3D models making up the imagery of Virtual Earth.

Zooming to the Mouse Pointer?
In VE's default navigation, the mouse scroll wheel zooms on the center of the screen. However, a new navigation option is available that causes VE to zoom directly to the mouse location itself. The feature can be a little counter-intuitive at first, because that functionality was previously reserved for a double click on the map. However, with a little practice, this lets users zoom to any point on the planet without clicking. You enable the feature with one line of code:

map.SetMouseWheelZoomToCenter(false);

Faster Shapes and New Methods
Shapes are interactive elements you can add to your map. These include:

  • Pushpins: These represent a single point.
  • Poly lines: These represent a path of many points.
  • Polygons: These represent a closed area of points.
Zindex
You can now change the Zindex of shapes (their relative vertical position in the image). As shapes can easily overlap, it is important to be able to control which shape appears on top or behind. You've probably encountered the same concept in applications such as PowerPoint, where you can send objects backwards or forward along the Z axis. Microsoft has added three new methods to retrieve and set the Zindex value for icons (pushpin), lines, and polygons, collectively called "polyshapes."



VEShape.GetZIndex(); VEShape.GetZIndexPolyShape(); VEShape.SetZIndex(icon, polyshape);

Altitude
In 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 AltitudeMode is an enumeration that supports the following options:

  • Absolute: This mode specifies altitude is in meters above the WGS 84 ellipsoid.
  • RelativeToGround: This mode specifies altitude is in meters above ground level (default).
This opens up a world of possible 3D mode visualizations for anything above ground. You may have already seen some great applications that track in-flight aircraft online.

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
One common issue with Virtual Earth is that as you zoom out, shapes overlap. You have already seen how you can adjust the Zindex, but now you can hide shapes. Two new methods let you specify the maximum and minimum zoom levels at which a shape is visible:

VEShape.SetMaxZoomLevel(level); VEShape.SetMinZoomLevel(level);

Using these methods, you can simply hide some or all of the shapes, or provide additional shapes at other zoom levels, increasing or reducing the shape density.

Reduction of Polygon/Poly Line Accuracy
Enabled by default, Virtual Earth will now remove points within a polygon or poly line that are visually too close at the current zoom level. The idea is to reduce the complexity of object rendering to improve performance. For example, when you view a thousand-point polygon over New York at the country level, it needs only a few points—or may be too small to bother rendering at all.

You can disable this new performance feature with the following code:

map.EnableShapeDisplayThreshold(false);

Performance of Bulk Add
To upgrade existing applications, rather than adding shapes directly to the map, add your shapes to an array, and then add the shape array to the map in one call.
The Virtual Earth team has made a significant performance improvement for adding many pushpin shapes to the map. The simple change lets you add an array of shapes in the existing AddShape function:

VEShapeLayer.AddShape(Array);

The performance increase is noticeable; Table 2 shows performance improvements of using the bulk method over a loop of single AddShape() calls.

Table 2: Performance comparison of AddShape() as executed in Internet Explorer 7 under Microsoft Vista x64 on a Dell XPS1330 2.4 Ghz 4 GB RAM.

Number of Pins

Single Add in Loop (sec)

Bulk Add (sec)

1

0.008

0.004

10

0.066

0.022

100

0.632

0.209

500

2.883

1.477

1000

7.264

2.259

2000

21.831

5.644


It's simple to change most existing applications so they can benefit from this performance improvement. Rather than adding shapes directly to the map, add your shapes to an array, and then add the 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 a huge number of accurate image tiles representing the Earth in several different formats. The system allows users to stream only the images required for their current view as they pan and zoom around the planet. This streaming architecture provides a fluid experience and fast load times for such a massive set of data. One powerful feature is the ability to add your own tile layers on top of the map, giving your data overlays or imagery the same highly-scalable performance. Here's where Map Cruncher comes into play.

 
Figure 7. MapCruncher Beta In Action: MapCruncher lets you import raster and vector-based images and align them with Virtual Earth.
Map Cruncher is a tool that imports raster-based and vector-based images, provides an interface to align those images properly 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.

Import Your Data Here
Lastly, Virtual Earth can now import the most common geocoding XML format, "KeyHole Markup Language" or KML. The import process is identical to the existing GeoRSS or Live collection import types; Microsoft added a new enumeration: VEDataType.ImportXML. For example:

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, because the data gets parsed by maps.live.com.

Conclusion
Virtual Earth has grown into a mature application that's ready for use in demanding enterprise applications. The recent update added new functionality, improved the user interface, and increased the performance without any breaking changes. Applications using VE version 5 may simply need to change the version number to "6." Note that, to support this, some functionality from previous versions, such as the old routing method, have been marked as deprecated.

  • VEMap.GetRoute: use VEMap.GetDirections instead.
  • VERouteDeprecated: old VERoute class.
  • VERouteItineraryDeprecated: old VERouteItinerary class.
The deprecated methods still work, but you should update them when you get a chance—and 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 is a director of Soul Solutions, based in Brisbane, Australia. John is a Windows Live Developer MVP, and moderates the Virtual Earth forum on MSDN. He is part of the core team that runs the ViaWindowsLive.com community site for Windows Live technologies. John has presented on Windows Live technologies at many events, including Tech Ed Australia, Museums and the web, and MSDN/SQL user groups.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap