各メンバーと現在の場所の間の距離を見つける必要があります。
CLLocation *memberlocation = [[CLLocation alloc] initWithLatitude:memberlat longitude:memberlong];
CLLocation *yourcurrentlocation = [[CLLocation alloc] initWithLatitude:currentlocationlat longitude:currentlocationlong];
CLLocationDistance distance = [memberlocation distanceFromLocation:yourcurrentlocation];
次に、それらを使用して最も近いメンバーを見つけることができ、独自のロジックを使用して、必要なソリューションのコードを取得できます。
1000 の住所と自己の位置を比較するのに時間がかかると思われる場合は、すべてのメンバー lat-long があるサーバー Web サービスに自己の位置 lat-long を送信します。Web サービスでは、次のクエリを使用して最も近い 20 を見つける必要があります。メンバー。
SELECT top (20) id, ( 6371 * acos( cos( radians(13.0610) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(80.2404) ) + sin( radians(13.0610) ) * sin( radians( lat ) ) ) ) AS distance
FROM markers ORDER BY distance;
ここでは、13.0610 の代わりに自分の位置の緯度を渡す必要があり、80.2404 は経度です。