Name.com Cyber Monday sale: $6.99 .com domains and more. Shop the sale.

Search Script Zip Code Distance Option

Spacemail by SpaceshipSpacemail by Spaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
Longitude and Latitude are not implemented in google maps
 
0
Close
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
Close
easily the best, most efficient, and cheapest solution to your problem, but if not your interest..understood
 
0
Close
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
Close
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
Close
Status
Not open for further replies.
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back