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:
Table 1 gives the complete list of supported locales.
Table 1: A complete list of supported locales.
English, Great Britain
English, United States
Czech, Czech Republic
Second, to enable the localized directions, set the property UseMWS
in the GetDirections
method as follows:
Improved Geocoding and Confidence Data
var myRouteOptions = new VERouteOptions();
myRouteOptions.UseMWS = true;
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 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
var map = new VEMap("mymap");
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.