Whilst developing my latest application I was faced with the issue of finding nearby locations from a SQLite database containing over 60,000 records. Each record contained a latitude, longitude and location name.
The problem was how to quickly find the closest locations without having to calculate the distance between the current location and target location for every record.
The solution I came up with has two parts. First, I applied a limit clause to my select statement to only return the top 100 rows within +/- 1 degree of my current latitude and longitude.
One degree equals approximately 111km (61 miles) so by filtering for +/- 1 degree we are effectively selecting the top 100 records within a 222km radius of the current location.
It is then a relatively simple task to calculate the distance between the current location and selected locations and order by distance.
I came across a new application from
Logitech today that allows you to use your iPhone as a
mouse/keyboard to remotely control your computer.


Some
of you may be familiar with an open source project called
Mono which was aimed at making .Net applications run on the linux
platform. A similar project has now been built by