Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

zipcode and mileage

Status
Not open for further replies.

rjkealey

Programmer
Feb 14, 2003
84
US
Hey all I am trying to add a asp page where user enters 2 zipcodes and it returns total mileage kinda like google but stay on my page and list total miles any ideas where I can get an access db to do this
Thanks in advance
 
Take a look at this site:


There are databases you can download. They may not be in Access, but it shouldn't be too hard to import that data in to Access. I haven't looked in a while, but I think there are latitude/longitude coordinates included with the data.

Here is a VB6 function to calculate the straight line distance between a pair of Latitude/Longitude coordinates.

Code:
Public Function CalculateDistance(ByVal StartLongitude As Single, ByVal StartLatitude As Single, ByVal EndLongitude As Single, ByVal EndLatitude As Single) As Single
    CalculateDistance = Sqr((EndLongitude - StartLongitude) * (EndLongitude - StartLongitude) * Cos((StartLatitude + EndLatitude) / 114.591559026165) * Cos((StartLatitude + EndLatitude) / 114.591559026165) * 4784.39411916406 + (EndLatitude - StartLatitude) * (EndLatitude - StartLatitude) * 4766.8999155991)
End Function

Understand that this is crowfly/straight line distance. As such, this does not pay attention to streets, traffic, speed limits, construction, etc...

Hope this helps.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
You can use the Google Maps APIs without showing their map. Have a look at and scroll down to the distanceFrom method. This will return a true geodesic (great circle) distance between 2 latlong pairs

If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top