Populate ListView from SQLiteDate sorting by Distance from user

I am working on my first app, and want to make a list that will pull venues from a database and then sort them by distance from the user positions. I haven't done the coding to get the users position but know there are plenty of tutorials for that, and for now can just use a fixed arbitrary point.

What I need help with is calculating the distance and then using the distances to build the list. I am making the database from scratch so I can use Lat, Long for position or anything else, for instance if addresses would be a useful(I figured lat, long was the most straight forward).

I don't know where to begin as I am not familiar with SQL to know if there would be any way to query such a thing. Then in terms of sorting it, the database doesn't have a distance column (yet, but could if you would recommend it) and it would need to be updated every time the user moved. My other thought is to convert the cursor into an array and then just create the distance variable that way.

I hope I have described my problem in enough detail and apologize for not providing any code. Thanks to everyone in advance for recommending methods to approach this.

Answers


Need Your Help

Perl Script not working on Mac

perl file-copying network-share

I wrote a script in Perl to move images to a network share drive which works fine on a PC. When I try to run it on a Mac all I get are error messages. I can't figure out what is causing the problem.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.