IPhone 3G: How to show locations around a fixed point?

I have the current location set via CoreLocation. Now I want to get these locations (from an existing database) that are near (about 100 feet) from it.

How do I get started?


Update: here is the implementation of Haversine's formula: http://www.jaimerios.com/?p=39 (very helpful)

0


a source to share


2 answers


CLLocation

provides a method for this:

- (CLLocationDistance)getDistanceFrom:(const CLLocation *)location



You will need to have the latitude and longitude of each of your records and then sort by the distance returned by this method.

+7


a source


FTW High School Geometry:

dist = sqrt(pow((x2-x1), 2) + pow((y2-y1), 2))

      



One of the things you can do to simplify the SQL Query is to split the map into "tiles", that is, an area of ​​2 km x 2 km so that you can query down to a tile, and then loop through the results using this formula ...

-1


a source







All Articles