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.
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.
Comments on Zip Code sensitivity
Forum Regular
Usergroup: Customer
Joined: Nov 25, 2003
Total Topics: 70
Total Comments: 211
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.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
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.
Forum Regular
Usergroup: Customer
Joined: Nov 25, 2003
Total Topics: 70
Total Comments: 211
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.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
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.