| | |||||
| ||||||||
| Web Development Wanted Requests for websites, templates, custom programming, logos or graphics. |
![]() | NamePros Design Contests | Forum Sponsorship |
| Join in on the FUN! You can start an affordable design contest and pick from entries talented members submit or you can enter a design contest for a chance to win CASH PRIZES! What are you waiting for? Get started in the fun TODAY! - Banners, Logos, Mascots, and MORE! (Please READ the design Contest section rules Prior to starting or entering a contest) | ||
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Dec 2004 Location: Florida
Posts: 2,627
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Search Script Zip Code Distance Option I have a search script that right now when you enter a zip code, it only finds ads that are in the zip code. I want it to have a few options (50 miles, 100 miles, 200 miles, and 500 miles). Please let me know your quote. Like I said, I have the script to do the search - I just need someone to add a zip code distance option. Thanks |
| |
| | #2 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,074
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Just a note. Before you can do something like that you will need to buy a database such as the 1 http://www.teamredline.com/ offer. This will give you the longitude and latitude of the zip codes which then enable you to work out the distance.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #4 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,074
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft | ||||
| |
| | #6 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,074
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | If i remember correctly to calculate the distance between 2 points using data retrieved from google maps is quite complex. I am sure I have a book around somewhere that explains how to do it and it entails calculating the curvature of the earth etc.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #7 (permalink) |
| Account Suspended Join Date: Sep 2006 Location: Washington, DC
Posts: 243
![]() ![]() ![]() ![]() ![]() ![]() | Not actually too involved, as most of the most complex operations are integrated...Uses the Haversine formula, implemented in JavaScript is: var R = 6371; // km var dLat = (lat2-lat1).toRad(); var dLon = (lon2-lon1).toRad(); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d = R * c; where var d is your distance- And no need to buy a zip code database, I have one you can have for free, if interested. ????: NamePros.com http://www.namepros.com/web-development-wanted/351184-search-script-zip-code-distance-option.html ____________________ BUT, as far as what youre trying to do it sounds like some additonal iterations of your search script, in combination with a distance modifier would do the job, i have a good idea of what would be required to do this, if interested let me know
Last edited by additionalfriends; 08-01-2007 at 06:45 PM.
|
| |