Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MATH - getting rows within a radius
Message
 
To
26/04/2007 12:08:55
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01219992
Message ID:
01220218
Views:
15
>>I have a table of warrants with latitude and longitude, and I would like to be able to select all warrants within a given radius. I know I've seen this discussed before. Any of you math professors got a clue?
>
>The simplest (combining database and maths) would be to select those which fall into a square of the same size - i.e. which differ north/south and east/west by no more than a given radius - that should reduce the number of hits with a single simple SQL call. Then among those, exclude any where N/S distance squared plus E/W distance squared is larger than your radius squared. The remaining guys are in your radius.

This is the most efficient way to do it when dealing with a lot of geographic records.

I've done it before for a radio frequency coordination application when finding radio transmitters w/in certain radius of a station on a given frequency. The transmitter database had over 6 million records (in VFP table).

Pulling a subset of data based on a 'box' bounded by lat and lon lines that were the desired distance out made final determination of distances and elimination of records outside the radius MUCH faster than determining distance as part of the initial select. I did use a great-circle distance calculation rather than hypotenuse because some of the searches involved long distances.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform