473,386 Members | 1,835 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,386 software developers and data experts.

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 9294

On 28-Jan-2004, "Bacci" <ba***@shimmi.com> 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*********@willglen.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*******************@newssvr25.news.prodigy. com...

On 28-Jan-2004, "Bacci" <ba***@shimmi.com> 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*********@willglen.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*******************@newssvr25.news.prodigy. com...

On 28-Jan-2004, "Bacci" <ba***@shimmi.com> 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*********@willglen.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*******************@newssvr25.news.prodigy. com...

On 28-Jan-2004, "Bacci" <ba***@shimmi.com> 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*********@willglen.net (it's reserved for spammers)

Jul 17 '05 #5
"Bacci" <ba***@shimmi.com> wrote in message news:<V_0Sb.178697$na.291973@attbi_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.phparchitect.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.com> 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*********@willglen.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*****************@newssvr29.news.prodigy.co m...


On 29-Jan-2004, "Bacci" <ba***@shimmi.com> 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*********@willglen.net (it's reserved for spammers)

Jul 17 '05 #8

On 30-Jan-2004, "Bacci" <ba***@shimmi.com> 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*********@willglen.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
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...
15
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...
2
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...
1
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 ...
1
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...
9
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
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...
20
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...

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.