473,395 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to "Find store locations near you" in VB?

I have to find zipcodes within a given mileage range (25, 50, etc). I know
it's possible to use the longitude/latitude to find this, and I have that
for the zipcodes, but does anyone have a "ready made" formula? I know it has
something to do with the sine/cosine, but the "signs" aren't clear enough to
me (neither are the wonders).

Thanks in advance for the wisdom.

J
Jul 17 '05 #1
4 13227

"321ConTact" <co*******@sNpOvSiPsAiMonREMOVECAPS.com> wrote in message
news:MY**********************@twister.tampabay.rr. com...
I have to find zipcodes within a given mileage range (25, 50, etc). I know
it's possible to use the longitude/latitude to find this, and I have that
for the zipcodes, but does anyone have a "ready made" formula? I know it has something to do with the sine/cosine, but the "signs" aren't clear enough to me (neither are the wonders).


There is no formula for this. The US postal service does not assign zip
codes by longitude / latitude and distance can only be measured between two
valid addresses but not zip codes.

If not obvious, I live on the boundary of two zipcodes. My two door away
neighbor is in a different zip code.
Jul 17 '05 #2
Thus spake "Raoul Watson" <Wa*****@IntelligenCIA.com>:
"321ConTact" <co*******@sNpOvSiPsAiMonREMOVECAPS.com> wrote in message
news:MY**********************@twister.tampabay.rr. com...
I have to find zipcodes within a given mileage range (25, 50, etc). I
know it's possible to use the longitude/latitude to find this, and I
have that for the zipcodes, but does anyone have a "ready made"
formula? I know it

has
something to do with the sine/cosine, but the "signs" aren't clear
enough

to
me (neither are the wonders).


There is no formula for this. The US postal service does not assign
zip codes by longitude / latitude and distance can only be measured
between two valid addresses but not zip codes.

If not obvious, I live on the boundary of two zipcodes. My two door
away neighbor is in a different zip code.


True, but at the "heart" of each ZIP code is a post office, which certainly
does have a longitude and latitude; you can use the post office as a proxy
for the entire ZIP code, bearing in mind that Los Angeles ZIP codes are
tiny but Wyoming ZIP codes are huge...

All that being said, I'm afraid my trig skillz aren't up to the OP's
original question. Sorry.
Jul 17 '05 #3
> I have to find zipcodes within a given mileage range (25, 50, etc). I know
it's possible to use the longitude/latitude to find this, and I have that
for the zipcodes, but does anyone have a "ready made" formula? I know it has
something to do with the sine/cosine, but the "signs" aren't clear enough to
me (neither are the wonders).


It depends on what you are trying to do. Assuming Long/Latitude creates
perfectly horizontal and vertical lines (which they do in about 25-30miles
radius), then a famous mathematician might be able to help.

Pythagoras (Greece, BC) came up with a rule we still use today.
(a^2) + (b^2) = (c^2)
If a = latitudinal distance, b = longitudinal distance, then c = distance
between the two points.
For each ZIP code, you'll have to do
a = x1 - x2
b = y1 - y2
c = Sqrt((a^2) + (b^2))
Where x1 is latitude of the "from" ZIP, x2 is lat. of the "to" ZIP,
y1 is long. of the "from" ZIP and y2 is long. of the "to" ZIP.

Alternatively, a is the difference in latitude of the two ZIPs, b is the
difference in longitude of the two ZIPs. These can be negative, as squaring them
makes them positive in any case.

Now, if c =< 25, then the distance is less than or equal to 25miles from ZIP to
ZIP.

Finally, the bummer: Where do you measure long/latitude?
You can either find the middle of the streets ((left end + right end) / 2) or
you can find some other way.

Trig doesn't come into it, unless the distance is large (such as 100miles) as
the curvature of the Earth forces us to abandon Euclidean co-ordinate systems
and think spherically, which is too difficult.

--
QuickHare
(BSc in Maths with Computer Science)
(QuickHare "at" Hotmail "dot" com)
Jul 17 '05 #4
I have to find zipcodes within a given mileage range (25, 50, etc). I know
it's possible to use the longitude/latitude to find this, and I have that
for the zipcodes, but does anyone have a "ready made" formula? I know it has
something to do with the sine/cosine, but the "signs" aren't clear enough to
me (neither are the wonders).

Thanks in advance for the wisdom.

J
Check this pdf link from ZipCodeWorld:

http://www.zipcodeworld.com/docs/distance.pdf.

It shows code examples for various languages and scripts. Can visit the zipcodeworld.com site for dot net controls etc. :) Hope this helps.
Jun 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Galsaba | last post by:
Anyone knows how I can find a script for "Find a Dealer near you" locator script? I prefer to have it in two stages: 1. The customer will enter his address, and then the result will be a list of...
1
by: Galsaba | last post by:
I am trying to write one. Are there any tools that I need to use to write it?(may be mapPoint?) I think that there are two ways to write the appication: 1. Having database of all my dealers,...
1
by: Galsaba | last post by:
I am trying to find a script to a "dealer locator" or "find a store near you". I will have two tables. One will include all US and Canada ZIPs including lat and longtitudes. The other one is a...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
8
by: Joe | last post by:
I need an Access application that can search dealers from my dealer list, in a 30 miles distance from the user. You may see many applications like this on the web if you search under "find a...
2
by: Todd Nathan | last post by:
Hi. have this code and compiler problem. GCC 2.95.3, BeOS, error "initializer element is not constant" #ifdef FILEIO { static struct { char *sfn; FILE *sfd; } stdfiles = {
1
by: Francesc Guim Bernat | last post by:
Dear colleagues, i'm getting in troubles using one XML library with Visual Studio .NET and Xerces with Xalan. When i execute the code i get the next run time error: "Run-Time Check Failure #2...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.