Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Search Script Zip Code Distance Option

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch
Status
Not open for further replies.
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
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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.
 
0
•••
Longitude and Latitude are not implemented in google maps
 
0
•••
additionalfriends said:
Longitude and Latitude are not implemented in google maps

Who said anything about google maps. The op wanted to be able to work out the distance between 2 zip codes. Google maps was never mentioned.
 
0
•••
easily the best, most efficient, and cheapest solution to your problem, but if not your interest..understood
 
0
•••
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.
 
0
•••
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.

____________________
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:
0
•••
Status
Not open for further replies.
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back