Login | Register   
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 2

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
Create Your Own 3D Models
Virtual Earth has had world-class, highly accurate, 3D models for some time. Now, thanks to a partnership with Dassault, the new 3DVIA technology allows you to create your own models within Virtual Earth just like Figure 3. The application allows you to build your 3D model in a simple environment and add either built-in textures or your own. This allows you to capture an image yourself for use on your custom model.

 
Figure 3. Building a 3D model in 3DVIA: Here's a basic house with textures generated from a 3D model.

The models themselves are stored at http://maps.live.com in a personal "collection," and you can add them to your own map by importing that collection as a layer as follows:

The new 3DVIA technology allows you to create your own models within Virtual Earth.

var l = new VEShapeLayer(); var veLayerSpec = new VEShapeSourceSpecification( VEDataType.VECollection, "54139577DC329980!625", l); map.ImportShapeLayerData( veLayerSpec,null,false);

Routing Now Supports Multiple Points
 
Figure 4. Getting Directions: Here's a route with turn-by-turn directions.
Do you want to enhance your application by letting your users get visual and textual map directions? Great news, the Virtual Earth routing functions have had a complete makeover for version 6.

Routing will overlay a line along the streets and roads and provide turn-by-turn instructions for your selected route, see Figure 4 for an example. The new method VEMap.GetDirections() accepts an array of locations for true multi-point routing and the return method gives a wealth of information about the resulting route, including distances and estimated time. You can format this information into turn-by-turn directions. Listing 2 provides a simple example.

Importantly, the objects added to the map are true VEShape classes. Virtual Earth no longer uses the old VEPushpin, VEPolygon and VEPolyline classes.

The GetDirections method allows you to specify the following options:

  • Whether to display measurements in kilometers or miles
  • Whether to draw the route on the map
  • Route line color
  • The line weight (thickness)
  • Line Zindex (above or below other objects)
  • Whether to set the map view to best fit the route
  • Whether to show a disambiguation dialog box if it can't determine any of the supplied locations
  • Whether to show error messages
 
Figure 5. Traffic Flow in San Francisco: The overlaid lines show typical traffic flow in the city of San Francisco.
Traffic Overlays Anyone?
Being able to plot a route is great, but how about overlaying the latest traffic flow data, as shown in Figure 5?

VE supports such traffic-flow mapping in an ever-growing number of cities. It's as simple to use as adding one line of code:

map.LoadTraffic(true);

You can easily show a built-in legend to explain the colors (customizable options include the title and the position of the legend on the map):



map.LoadTraffic(true); map.ShowTrafficLegend(200, 200); map.SetTrafficLegendText("myTraffic");

Support for SSL (Encrypted, Secure) Web Sites
Virtual Earth targets commercial applications with accurate and feature-rich functionality. Version 6 now supports HTTPS for the growing number of enterprise, e-commerce, and membership applications that require this level of security for communications. Previously, if your site ran under SSL, you either had to redirect to another page or your users had to put up with mixed-content warning messages.

You need to make two changes to the Virtual Earth script URL to enable SSL. First, change the protocol to SSL; second, add a query parameter of s=1. Here's the complete modified script URL:

<script type="text/javascript" src="https://dev.virtualearth.net/mapcontrol/mapco ntrol.ashx?v=6&s=1"></script>

Author's Note: SSL functionality is available only to paying Virtual Earth customers at this time.



Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap