calculating distance

A

Aaron

We have a DB with customers along with their cities and zips.
When the user enters a random city, do you know of any program that can be
bought, or any VB code that can calculate the distance between the entered
city and the cities of the customers?

I know how to integrate mapquest with access, however, I'd like this to be
query based, in which the user enters for example chicago, IL, and the query
returns all customers within 100 miles of Chicago, IL.

Any help is greatly appreciated.
 
T

Tatakau

You can make your own custom solution relatively easily. It'll take a bit of
brain power, but it's easy enough to think through the process.

First, you want to go online and find a zip code database. I am searching
right now on Google for the one I picked up a month ago, but if you can't
find one I could e-mail mine to you (664 kb compressed). This zip code
database contains not only the city, county, and state, but it also has the
latitudes and longitudes of these places as well.

From here, the rest is easy. You might have to convert from .txt to .mdb
though. PITA. Link your database to the ZIP code database, and now all
that's left is a bit of math. You'll need to know that the radius of this
ginormous blue marble is about 6378.137 km, or about 3963.19 miles, and go
ahead and assume that it's a perfect sphere to make life easier.
Circumference is 2 * PI * radius, 360 degrees in a circle, mix in some
algebra, and you'll be sittin' pretty in no time!

hth,

Nick
 
T

Tatakau

From the web:

Distace = Earth-Radius * (arccos (sin(a)*sin(b) + cos(a)*cos(b)*cos(P1-P2)))

Nick
 
A

Aaron

a, b and P1 AND P2 are what values?

Are P1 and 2 the lat for the 2 points.
and then you figure out the distance for the long in a second eq?
Then figure true distance by those two?

Thanks for the help!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top