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 3

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
Localization, First Steps
Microsoft must address a number of different areas to fully localize Virtual Earth. These include the control text, the map tiles themselves, and the web service results. Version 6 provides the first steps towards localization by providing localized direction information for routing. It takes two changes to enable localized results. First, you add a locale query parameter to the Virtual Earth script URL. For example, to localize to French (fr-fr), you would write:

<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcon trol.ashx?v=6&mkt=fr-fr"></script>

Table 1 gives the complete list of supported locales.

Table 1: A complete list of supported locales.

Description



Code

English, Canada

en-ca

English, Great Britain

en-gb

English, United States

en-us

Japanese, Japan

ja-jp

Czech, Czech Republic

cs-cz

Danish, Denmark

da-dk

Dutch, Netherlands

nl-nl

Finnish, Finland

fi-fi

French, France

fr-fr

German, Germany

de-de

Italian, Italy

it-it

Norwegian, Norway

nb-no

Portuguese, Portugal

pt-pt

Spanish, Spain

es-es

Swedish, Sweden

sv-se

Chinese, China

zh-cn


Second, to enable the localized directions, set the property UseMWS to true in the GetDirections method as follows:

var myRouteOptions = new VERouteOptions(); myRouteOptions.UseMWS = true; map.GetDirections(['redmond,wa','seattle,wa'], myRouteOptions);

Improved Geocoding and Confidence Data
Geocoding is the process of assigning latitude and longitude values to data such as street addresses. To position anything on the Virtual Earth map, you need the location as a VELatLong class. Clearly, it is unlikely you'd actually know the coordinates unless you're getting the data from a GPS device or it's previously been geocoded. Therefore, Virtual Earth provides geocoding within its routing and, importantly, through the VEMap.Find() method.

The VEMap.Find() method is responsible for geocoding a user-submitted location. This process makes a best guess, based on the text supplied. The method returns an array of VEPlace objects, which contains:

  • VEPlace.LatLong: Gets a VELatLong Class object that represents the location of the found result.
  • VEPlace.Name: Gets the String object that represents Virtual Earth's unambiguous name for the location.
  • VEPlace.MatchCode: A VEMatchCode enumeration value specifying the match code from the geocoder.
  • VEPlace.MatchConfidence: A VEMatchConfidence enumeration value specifying the match confidence from the geocoder. Values are High, Medium, or Low confidence.
The VEMatchCode enumeration contains these values:

  • None: No match was found.
  • Good: A successful match was found.
  • Ambiguous: A number of possible locations match.
  • UpHierarchy: The match was found by a broader search.
  • Modified: The match was found, but in a modified place.
These classes give you the detailed information you'll need to customize the results for your application and required accuracy.

Virtual Earth now supports "Roof Top Geocoding" in the United States. Rather than simply marking the location of the address on the road, this process marks the actual house or building at that address. Again, this is a very important feature for real estate applications.

Usage Tracking and Client Identification with Tokens
The Virtual Earth platform now supports a mechanism to track individual usage. Essentially, your web server requests a specific token identifier using a secure web service for each instance of a Virtual Earth map you serve. This token, specific to your application, gets set within the JavaScript Virtual Earth control before the map is loaded:

var map = new VEMap("mymap"); map.SetClientToken(token); map.LoadMap();

As JavaScript executes on the client, this token is public. For this reason the token is generated uniquely for each map, specific to your application.

Microsoft has added two new Virtual Earth events to support possible errors with tokens. You can attach to ontokenerror to receive notification if the token is not valid. Second, as the tokens themselves have a configurable lifespan, you attach to ontokenexpire to receive a notification when the token expires.

The usage statistics are then available for review on the Virtual Earth Platform Customer Services site alongside your MapPoint web service usage.

Author's Note: Microsoft recommends that all commercial applications implement the new tracking system. It will be a requirement of the Service Level Agreement (SLA) offered to commercial customers.



Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap