473,695 Members | 2,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Zip Code Radius Search

I'm creating a zip code radius search. I have a general understand of how
this works, but am puzzled by how to get my final list of company locations.

I have setup two database tables: one with zip codes w/latitudes and
longitudes and the other with company names and addresses. The user enters
their zip code and the corresponding latitude and longitude is returned. I
then use this to return a list of zips, latitudes and longitudes within a
given radius of the original zip.

Using this list, how do I get my final list of company locations? I can loop
through the list one by one, but is there a more efficient way?

Thanks in advance!
Jul 17 '05 #1
8 9310

On 28-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:
I'm creating a zip code radius search. I have a general understand of how
this works, but am puzzled by how to get my final list of company
locations.

I have setup two database tables: one with zip codes w/latitudes and
longitudes and the other with company names and addresses. The user enters
their zip code and the corresponding latitude and longitude is returned. I
then use this to return a list of zips, latitudes and longitudes within a
given radius of the original zip.

Using this list, how do I get my final list of company locations? I can
loop
through the list one by one, but is there a more efficient way?


Look up the users lat/long
Join zip and company on zipcode, create a field that contains the distance
from the users lat/long to the company's order by that distance (this can be
done in one SELECT)

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #2
Tom,

That should do it--thanks!

I'm somewhat concerned about performance. That is, how long it will take to
return a recordset again a database of over 52K records. Hopefully it won't
be too bad.

BTW, what's up with your signiture? Revenge? I'm thinking about doing the
same for a "deserving" group.

"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:cV******** ***********@new ssvr25.news.pro digy.com...

On 28-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:
I'm creating a zip code radius search. I have a general understand of how this works, but am puzzled by how to get my final list of company
locations.

I have setup two database tables: one with zip codes w/latitudes and
longitudes and the other with company names and addresses. The user enters their zip code and the corresponding latitude and longitude is returned. I then use this to return a list of zips, latitudes and longitudes within a given radius of the original zip.

Using this list, how do I get my final list of company locations? I can
loop
through the list one by one, but is there a more efficient way?
Look up the users lat/long
Join zip and company on zipcode, create a field that contains the distance
from the users lat/long to the company's order by that distance (this can

be done in one SELECT)

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)

Jul 17 '05 #3
Tom,

That should do it--thanks!

I'm somewhat concerned about performance. That is, how long it will take to
return a recordset against a database of over 52K records. Hopefully it
won't
be too bad.

BTW, what's up with your signiture? Revenge? I'm thinking about doing the
same for a "deserving" group.

"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:cV******** ***********@new ssvr25.news.pro digy.com...

On 28-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:
I'm creating a zip code radius search. I have a general understand of how this works, but am puzzled by how to get my final list of company
locations.

I have setup two database tables: one with zip codes w/latitudes and
longitudes and the other with company names and addresses. The user enters their zip code and the corresponding latitude and longitude is returned. I then use this to return a list of zips, latitudes and longitudes within a given radius of the original zip.

Using this list, how do I get my final list of company locations? I can
loop
through the list one by one, but is there a more efficient way?
Look up the users lat/long
Join zip and company on zipcode, create a field that contains the distance
from the users lat/long to the company's order by that distance (this can

be done in one SELECT)

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)

Jul 17 '05 #4
Tom,

That should do it--thanks!

I'm somewhat concerned about performance. That is, how long it will take to
return a recordset against a database of over 52K records. Hopefully it
won't be too bad.

BTW, what's up with your signature? Revenge? I'm thinking about doing the
same for a "deserving" recipient.

"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:cV******** ***********@new ssvr25.news.pro digy.com...

On 28-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:
I'm creating a zip code radius search. I have a general understand of how this works, but am puzzled by how to get my final list of company
locations.

I have setup two database tables: one with zip codes w/latitudes and
longitudes and the other with company names and addresses. The user enters their zip code and the corresponding latitude and longitude is returned. I then use this to return a list of zips, latitudes and longitudes within a given radius of the original zip.

Using this list, how do I get my final list of company locations? I can
loop
through the list one by one, but is there a more efficient way?
Look up the users lat/long
Join zip and company on zipcode, create a field that contains the distance
from the users lat/long to the company's order by that distance (this can

be done in one SELECT)

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)

Jul 17 '05 #5
"Bacci" <ba***@shimmi.c om> wrote in message news:<V_0Sb.178 697$na.291973@a ttbi_s04>...
I'm creating a zip code radius search. I have a general understand of how
this works, but am puzzled by how to get my final list of company locations.

I have setup two database tables: one with zip codes w/latitudes and
longitudes and the other with company names and addresses. The user enters
their zip code and the corresponding latitude and longitude is returned. I
then use this to return a list of zips, latitudes and longitudes within a
given radius of the original zip.

Using this list, how do I get my final list of company locations? I can loop
through the list one by one, but is there a more efficient way?


This is not the solution for your question. But, this is a good
link on the topic <http://www.phparchitec t.com/sample.php?disc _show=316&mid=9 >

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #6


On 29-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:

Look up the users lat/long
Join zip and company on zipcode, create a field that contains the
distance
from the users lat/long to the company's order by that distance (this
can be
done in one SELECT)

I'm somewhat concerned about performance. That is, how long it will take
to
return a recordset again a database of over 52K records. Hopefully it
won't
be too bad.

BTW, what's up with your signiture? Revenge? I'm thinking about doing the
same for a "deserving" group.


It's just arithmetic, so I think performance will be OK. I've used it a bit,
but not on a large table.

James Butler was one of Walter Matthew's aliases in the movie Hopscotch. I
use it as a honey pot for spammers, any email to that account goes directly
to spamcop.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #7
For performance reasons, I'm going to pre-calculate the high latitude and
longitude.

BTW, you and I have similar backgrounds and interests. I am web application
developer by trade, but have been doing photography since high school. I was
film based until finally converting to a digital about a year ago. I'd
eventually like to get out of development all together and follow my bliss.
Time will tell...

"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:29******** *********@newss vr29.news.prodi gy.com...


On 29-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:

Look up the users lat/long
Join zip and company on zipcode, create a field that contains the
distance
from the users lat/long to the company's order by that distance (this
can be
done in one SELECT)
I'm somewhat concerned about performance. That is, how long it will take
to
return a recordset again a database of over 52K records. Hopefully it
won't
be too bad.

BTW, what's up with your signiture? Revenge? I'm thinking about doing

the same for a "deserving" group.


It's just arithmetic, so I think performance will be OK. I've used it a

bit, but not on a large table.

James Butler was one of Walter Matthew's aliases in the movie Hopscotch. I
use it as a honey pot for spammers, any email to that account goes directly to spamcop.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)

Jul 17 '05 #8

On 30-Jan-2004, "Bacci" <ba***@shimmi.c om> wrote:
For performance reasons, I'm going to pre-calculate the high latitude and
longitude.
I suppose you could compute a square around the target zip and select those
zips that fall within the square the companies that are in those zips.

BTW, you and I have similar backgrounds and interests. I am web
application
developer by trade, but have been doing photography since high school. I
was
film based until finally converting to a digital about a year ago. I'd
eventually like to get out of development all together and follow my
bliss.
Time will tell...


I've been dragged kicking and screaming into digital. I now do very little
color film. I still do all my black and white in the darkroom, but I've
friends who are scanning B&W, photoshoping it and inkjet printing new negs.
Most of them are platinum printing, but I can see the advantages for hard to
print negs.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #9

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

Similar topics

5
2085
by: Shelly | last post by:
Does anyone know if there are any modules available that enable searches by zipcode for proximity? I want the user to enter a zipcode and then I want to somehow search for all entries in a database that are within, say, 25 miles of that zipcode. This is done in many, many sites on the net and I am wondering if anyone knows of an add-on package to make it happen. No sense in re-inventing the wheel. Shelly
15
7253
by: J Peterman | last post by:
I am trying to program a couple classes. One is called PositiveInteger and is supposed to just store a positive integer. The second class is called Circle, and is meant to describe a circle. Circle is meant to use PositiveInteger when describing the circle's radius. Sorry if haven't described it properly. Could someone take a look at my code and tell me where I am going wrong, and why it keeps giving me this error error C2533:...
2
3282
by: Nazir | last post by:
Hi - I know this isn't really a specific SQL Server question but I can't think of a better forum. I want to implement a more sophisticated UK postcode search on a site - "LIKE 'NW%'" etc, is not bringing back good enough results. A feature that would allow me to ask: "give me all outward postcodes in a 30 mile radius of NW10" would be ideal. Has anyone had to do this before? - any advice on how much
1
3025
by: Pietro | last post by:
Hi at all, I teach into a teachnical school and many boys must to know best CSS. I have two problems: 1)Making tables we'ld want make the cells with round angles. Therefore we apply -moz-border-radius-topleft ecc...... But it work only with Netscape 6 or more. Is there the mean to do to work with MSIE? 2)What is the best CSS book?
1
1788
by: Marek Mänd | last post by:
<div style="border:1px solid red;-moz-border-radius:10px"> <div style="margin:0px;padding:0px;background:white;">this is titlebar for my box</div> This is content for my box </div> Is there any hope the round borders can be fooled to show up?
9
3441
by: Sandy | last post by:
Hello - I need either a cheap tool or code & DB that calculates, eg. within 50-mile radius of a zip code. Anyone have any suggestions? -- Sandy
1
1944
by: Chris Ochs | last post by:
Has anyone ever taken a look at adding radius authentication to Postgresql? I know it's not terribly secure in itself, but some 2 factor authentication schemes like Cryptocard use it for verifying one time passwords, and at least in our case having 2 factor authentication for remote access would be really nice. ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the...
20
8119
by: chump1708 | last post by:
Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
3
2287
by: dimstthomas | last post by:
Hello Anyone know how to make an svg circle radius fixed (i.e. not affected by transforms)? I tried adding px or cm, e.g. r='15px' but it just generates an error. Thanks
0
8616
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8553
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9112
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
5826
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4332
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2994
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.