Calculating the Shortest Route Between Two Points

In the Windows Phone 8 SDK, two classes are fundamental in calculating a route: The GeocodeQuery class allows you to convert a street address to a GeoCoordinate, and the RouteQuery class finds the shortest path between two GeoCoordinates, with any number of way points in between.

The GeocodeQuery and RouteQuery class are located in the namespace Microsoft.Phone.Maps.Services.GeocodeQuery.

In the sample for this section, a custom class named RouteCalculator is used to calculate the route between two street addresses. The RouteCalculator class has a single method named CalculateAsync (see Listing 18.4).

The GeocodeQuery class has two required properties: SearchTerm and GeoCoordinate. SearchTerm ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.