Radius Search

M

Mark A. Sam

Hello,

I am looking for methods either custom or commercial to select cities in an
Access database along with the cites in the database within a selected
radius. For example if the user selected Chicago Ill and and a 100 miles
radius, all of the cities within 100 miles of Chicago would be returned and
could be directed to a table.

If anyone has done this or knows of a website I can check out which orfers
it, I would appreciate the lead.

God Bless,

Mark A. Sam
 
M

Michel Walsh

Hi,


Even if the question seems simple, there are many cases, such as do you
use geological or spherical coordinates for your cities, or just a so call
2D plane (x, y), or even else, do you use a list of path (roads) between
points and want to know what you can reach traveling less than 100 miles?

The easiest one is the 2D case (the path can be easy if you already have
the "tableau" of minimum distances between any point to any point): you
remove those outside the square with sides of 200 miles, centered on the
point, which is a simple comparison, then, use the equation of the circle to
remove the few extra points that are in the square, but not in the circle:

SELECT a.*
FROM Cities As a
WHERE a.x BETWEEN givenX-100 AND givenX + 100
AND a.y BETWEEN givenY-100 AND givenY + 100
AND (a.x-givenX)^2 + ( a.y-givenY) ^2 <= 100^2


That assumes you have the (x, y) value for all cities (or point of
interest). The WHERE clause is generally evaluated as supplied, from left to
right, and optimized so that if u AND v is to be evaluated, and u
is false, then v is not evaluated since the conjunction would be false
(short-circuit evaluation). Place the more complex expression last should
help (for the speed of execution).


Hoping it may help,
Vanderghast, Access MVP
 
M

Mark A. Sam

Hello Michel,

It does help, greatly and it seems like 2D plane case is sufficient, adding
5 or 10% to the selected radius. It is to list available loads for Truckers
in an area they are interested in, so I am just looking to include loads
from the surrounding areas.

I guess with that, the question is where does one get the table data? Is it
available from the government? Try to find out if they even have the
information is like pulling teeth from a chicken...lol.

Thank you for your response and God Bless,

Mark
 
M

Mark A. Sam

Michel,

Can I email you personally with a question? If yes, send me your email
address to

msam AT Truckloads DOT net

Thanks
 
M

Michel Walsh

Hi,


Have you ever take a look at Microsoft MapPoint 2002 as example? you
get graphical representation, not a "data" representation (but you can write
VBA code).
 
M

Michel Walsh

Hi,

It is preferable to ask here, so if I don't know the answer, maybe
someone else do.


Vanderghast, Access MVP
 
M

Mark A. Sam

Michel,

It isn't a technical question.



Michel Walsh said:
Hi,

It is preferable to ask here, so if I don't know the answer, maybe
someone else do.


Vanderghast, Access MVP


and cities
 
M

Mark A. Sam

Mappoint is for realtime location tracking. I need data for calulation to
display results. I am not interested where a truck is at any particular
time, becuase the data pertains to where it will be unloading and where it
needs to go. A database of distances between cites is what I need, but that
may be expansive. I am thinking that some type of routing algorithm needs
to be involved.

Thanks again.
 
M

Mark A. Sam

Actually, I was looking at Mappoint 2004 information which I assumed would
give me the same details, but after reading a review of Mappoint 2002, I see
what you mean and will look at this more closely.

God Bless,

Mark A. Sam
 

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