455,722 Members | 1,227 Online
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

# checking the radius in a web site

 P: n/a Hello, How do I check the radius for a user if they come to my web site and I want to find out how far certain churches are from where they live. For instance, display results for churches that are within 25 miles of where the person lives? Thank you any help with this. Aaron; Jul 17 '05 #1
4 Replies

 P: n/a >want to find out how far certain churches are from where they live.For instance, display results for churches that are within 25 miles ofwhere the person lives? Some web sites ask for a Zip code (assuming this is in the USA) and translate this to a set of coordinates for the center of that Zip code. Then you calculate the distance between that point and the known coordinates of the churches to select the close ones. It may be to your advantage to precalculate some of this, especially if the radius is ALWAYS 25 miles. For each church, calculate a list of Zip codes with a center point within 25 miles. Populate the database with that info, and you don't have to do any distance calculations once you've set up the data. Just look up the churches close to the zip code in question. You can use any coordinate system you want. For a large radius (like 1000 miles), you may need to use latitude/longitude degrees and the appropriate distance formula. For a smaller radius, where the curvature of the Earth is not relevant, coordinates on any map grid and the usual distance formula: r = (x2-x1)**2 + (y2-y1)**2 is fine. I have heard rumors of a Zip-code-to-coordinates database. I think the info in the Bureau of the Census TIGER data could be used to derive one, but it's really too detailed for direct use (but it could possibly be used to translate street addresses to coordinates at the street block level, but it likely requires a very clever parser). TIGER data for some of the larger counties in Texas is 2-4 megabytes of .zip file. Gordon L. Burditt Jul 17 '05 #2

 P: n/a "Aaron Collins" wrote in message news:ef**************************@posting.google.c om: Hello, How do I check the radius for a user if they come to my web site and I want to find out how far certain churches are from where they live. For instance, display results for churches that are within 25 miles of where the person lives? Thank you any help with this. Aaron; This was covered in the php|architect magazine in the May 2003 issue. The issue can be downloaded for free on their website at http://phparch.com/issue.php?mid=9 --- Mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.778 / Virus Database: 525 - Release Date: 15/10/2004 Jul 17 '05 #3

 P: n/a Hello, "Aaron Collins" wrote in message: How do I check the radius for a user if they come to my web site and I want to find out how far certain churches are from where they live. For instance, display results for churches that are within 25 miles of where the person lives? If you are in the US and you have a database of zip codes of all the known churches, you may want to try any of these classes that provide solutions for locating the entries that are located within the range of distance from a given user zip code: Class: php Zip Locator http://www.phpclasses.org/phpziplocator Class: Zip Codes Range http://www.phpclasses.org/zipcodesrange -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html Jul 17 '05 #4

 P: n/a Manuel Lemos wrote in message news:<41**************@acm.org>... Hello, "Aaron Collins" wrote in message: How do I check the radius for a user if they come to my web site and I want to find out how far certain churches are from where they live. For instance, display results for churches that are within 25 miles of where the person lives? If you are in the US and you have a database of zip codes of all the known churches, you may want to try any of these classes that provide solutions for locating the entries that are located within the range of distance from a given user zip code: Class: php Zip Locator http://www.phpclasses.org/phpziplocator Class: Zip Codes Range http://www.phpclasses.org/zipcodesrange -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html Thank you Manuel and everyone else who posted a response to my question. I've downloaded the Zip Locator class written my Dr. Tarique Sani and Girish Nair. I also enjoyed Dr. Sani's article in May 2003 PHP | Architect magazine. Thank you Kelvin for that link. This has been a blast learning how to calculate distances, and I'm grateful for everyone's input. Aaron; Jul 17 '05 #5

### This discussion thread is closed

Replies have been disabled for this discussion.