Reply to Re: Search by zip code

Your name:

Reply:


Posted by Jerry Stuckle on 09/27/39 11:20

Shelly wrote:
> 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
>
>

Shelly,

I don't have the code handy - but it's not hard to develop.

Basically store zip codes, longitude and latitude in a database (i.e. MySQL).

Take the long/lat of the entered zipcode. Create minimum and maximum long/lat
for your desired radius (a little searching of the internet will give you the
equations). Then search for any zip code with long/lat within the given range.

Finally, for fine tuning, check the distance of the returned zip code against
the entered zip code (similar formulae).

Last time I did it it was all of about six lines of code and ram in < 1 sec.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация