Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Calculate the distance between 2 points
Re: Calculate the distance between 2 points
As you've probably found, just scanning the database for all rows
meeting this condition is pretty slow, especially if you have a lot of
rows in your table.
One way I've found to make this faster is to create a square of the size
necessary. For instance, if you want to find everything within 25 km of
a point, create a square in your program with the corners your point +=
25km longitude and latitude. Now you have a preliminary area to work with.
Then you can search the database for anything within that square, and
fine tune the results to be within a circle of 25 km.
Hope this is clear.
Remove the "x" from my email address
JDS Computer Training Corp.
- The Natural Philosopher
December 30, 2010, 9:28 am