i am building an iphone app and i am looking for an idea how to get objects close to my position. the objects have an address listed in my database. now i am interested to show the objects that are close to mine on the map. how do i get that property? at first i thought of floyd-warshall but is there an better solution than coding that myself?
Share
The first thing you’ll need to do is get Lat Long positions in your database instead of Addresses. There is a tool that google provides that does this. There is also a manual approach.
Then you can use the Haversine formula to work out if it is within a certain radius of your location.
Here is a example. You can cycle through your objects(‘s location) on the map and see how far away they are from you.
You could amend this method to return TRUE if it is within a specific distance and FALSE if it does not:
To find out your current location you will need to use the CLLocationManager which is part of the iOS SDK.