Question

I'd like to work out the distance between two points. No map. No javascript. Just the distance.

I understand Google maps prohibits this and it's against their terms of service. But Bing Maps doesn't have this restriction.

I want to give the points in a general format, i.e "Cambridge" "Church Street, Newcastle"

How would I go about doing it? As basic as possible. It's for a mobile device.

Was it helpful?

Solution

1.) Sign up for a Bing Maps key at http://www.bingmapsportal.com. A key is a alphanumeric string of around 64 characters in length, something like: AtGYpcoIpC5zy0P2k4Bc4839b-=fLgbbnsp72T3ZrM0z7gAaMcjXlZPsKXghW

2.) Then, make a request to the Bing Maps Routes API (http://msdn.microsoft.com/en-us/library/ff701717.aspx) to generate a route between up to 25 waypoints. For the example given, substitute your Bing Maps key into the following URL:

http://dev.virtualearth.net/REST/v1/Routes?wp.1=Cambridge, UK&wp.2=Church St, Newcastle-under-Lyme, UK&key=ENTERYOURBINGMAPSKEYHERE

3.) You'll get a JSON response containing details of the route, turn-by-turn directions etc. as described at: http://msdn.microsoft.com/en-us/library/ff701718.aspx. The total driving distance is given quite near the bottom of the response, called "travelDistance" (in this case,218.703). You can also choose what units this value is returned in by specifying the appropriate distanceUnit parameter when you first request the route.

OTHER TIPS

Is very simple:

http://dev.virtualearth.net/REST/V1/Routes/Walking?wp.0=11025%20NE%208th%20St%20Bellevue%20WA&wp.1=700%20Bellevue%20Way%20NE%20Bellevue WA&key=BingMapsKey

Ref : MSDN

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top