ios - How can I search for locations in a certain radius? -


very surprised has been difficult search. hunt showed me use clgeocoder displaying information in user friendly format.

i'm building location based app, , have functionality save locations (to server) , list them in table view. of little use when cannot filter , arrange locations relevant area.

should heavy lifting of setting location radius in device, or in php?

my current idea solution send json string of coordinates php script looks through mysql database every entry has location field less x away user's location (by crude 'where x<34.23049823 , x>34.44789874 , y<...) type of thing. don't think easiest or quickest way implement nearby location search functionality.

of course can in ios.

// given nsarray *locations array of cllocation* wish filter  // , given radius... cllocationdistance radius = ksomeradius;  // , given target want test against... cllocation* target = [[cllocation alloc] initwithlatitude:somelat longitude:somelon];   nsarray *locationswithinradius = [locations objectsatindexes:                                  [locations indexesofobjectspassingtest:                                   ^bool(id obj, nsuinteger idx, bool *stop) {                                        return [(cllocation*)obj distancefromlocation:target] < radius;                                    }]];  [target release]; 

source - objective-c search locations radius


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -