Swiftfeet


I am working on a project where I need to know the driving distance between two points in feet. I am able to get everything working correctly, except that the only distance that I can get is miles to 1 decimal point. Is there a way to increase the precision to a predefined number...or really anything greater than 1 I know I could convert the milage to feet, but given that the given distance isn't very accurate it would not help. Thanks.



Re: Increase precision of distance

Richard_Brundritt


What you can do is take the lat and longs of the two points and calculate the distance between the points using the Haversine formula. Information on this can be found here: http://www.movable-type.co.uk/scripts/latlong.html Once you have that distance it's just a matter of converting it to the units you want.





Re: Increase precision of distance

Swiftfeet

I want to get more precise driving distance. I was using google maps api for the web application that I am working on. It had everything I wanted, except that I couldn't calculate and display the shortest driving distance on the map. I started looking at Virtual Earth and found that I could do what I wanted with it. The only issue is not having the precision that I had with google maps. I haven't had a chance to check out yahoo maps, or mapquest. Thanks for the help.





Re: Increase precision of distance

Richard_Brundritt

This article should be able to help you. http://viavirtualearth.com/vve/Articles/CustomizedRoutePushpins.ashx

It shows you how to step through each segment of a route. If you did the Haversone formula from point to point you would be able to get a more accurate distance. There would be a degree of error (curved roads) but the degree of the error would be less than a mile.