Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proximity search
Message
From
13/04/2010 14:07:41
 
 
To
13/04/2010 12:21:08
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01459851
Message ID:
01459999
Views:
22
>>Calculating the exact distance for every possible 'destination' seems like overkill?
>>If this is for the U.S. and only targets within a certain radius are required you could get a rough selection based simply on latitude and longitude.
>>There's pretty much a direct correlation for latitude (110 miles per degree) and given that the the U.S only extends from about 45-25 degrees it will always be between say 80-100 miles per degree of longitude. So grab the max by allowing an extra 20% on longitude then do the exact calculation on that result set? Not having the meridian pass through the country makes it easier as well.....
>
>So basically, we could simply rely on the Latitude and Longitude fields to apply our queries on. Is that correct? So, for example, if I want a radius of 20 km, what kind of +- formula should I calculate to allow + or - radius on the Latitude and Longitude?

I was suggesting a rough calculation that would find matches within a square area rather than a circle. 1 degree of latitude is approximately 111kms (not miles - I was wrong above) so places within 20km North or South would be within +/- 20/111 degrees of the the target latitude. Longitude is cruder. At 50 degrees N it's about 70km so 20km East or West would be +- 20/70. But using that formula for somewhere in, say, Florida would include places up to about 28Km either side. So I was suggesting using this method to get a first selection (which might include some places outside the target distance) and then to make the more accurate calculation using just those results.

But if you're getting acceptable performance doing the full calculation straightaway there's not much point.........

Also the best solution is going to depend on your data. For example if you have a lot of records per zip code it will make more sense to calculate zip codes within the target distance then look for records with that zip code. Conversely, if your records don't include that many zip codes there's no point in doing the calculation for zip codes that don't exist in the data......
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform