WebmasterSite.net

Zip Code sensitivity
results seemingly too broad

Version: 5.0.5
URL:

PrintPrint


Zip Code sensitivity
sparkalina
Forum Regular

Usergroup: Customer
Joined: Nov 25, 2003

Total Topics: 69
Total Posts: 198
quote post #1
Posted 09/21/08 - 9:43 AM:

I've been doing some test searches using the US postal codes.

It seems that the isn't much sensitivity to the zip code request.

IE I know that zipcode 91350 is more than a mile from 90210 (chatsworth versus beverly hills) so when I search for

"diner" within 1 mile of 90210, I should not get the listing in Chatsworth 91350. But I am.

Shouldn't I get "no result" because this item is located more than a mile from 90210?

Default search type for simple search set to: "contains".

I'm using the form examples from the manual and the one that is on the advanced search template.






Edited by sparkalina on 09/21/08 - 11:08 AM
Paul
developer
Avatar

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 65
Total Posts: 7614
quote post #2
Posted 09/22/08 - 3:26 PM:

How far are these away? It's certainly unlikely to be accurate to within a mile -- zip codes themselves aren't, my zip code covers 90.5 square miles. Who knows where in the zipcodes it has the lat/long from... and I don't know that the database has enough decimal places to resolve to a mile anyway. I'm just using public data.

Edited by Paul on 09/22/08 - 3:28 PM
sparkalina
Forum Regular

Usergroup: Customer
Joined: Nov 25, 2003

Total Topics: 69
Total Posts: 198
quote post #3
Posted 09/23/08 - 10:03 AM:

I know that the county chatsworth is in is more than 1 mile away from the county beverly hills is in. but if this is a limitation based on imported data that you nor I have control over, than my client will have to accept the discrepancies.
Paul
developer
Avatar

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 65
Total Posts: 7614
quote post #4
Posted 09/24/08 - 2:21 PM:

for $range distance from a zipcode:
$latitude = $r[0];
$longitude = $r[1];
$latrange = $range / 69.172;
$lonrange = abs($range / (cos($latitude) * 69.172));
$minlat = number_format($latitude - $latrange, "4", ".", "");
$maxlat = number_format($latitude + $latrange, "4", ".", "");
$minlon = number_format($longitude - $lonrange, "4", ".", "");
$maxlon = number_format($longitude + $lonrange, "4", ".", "");

All zipcodes which are in that square area are then searched.
 
Search thread for
Download thread as


Sorry, you don't have permission to post. Log in, or register if you haven't yet.