我目前正在爲iOS開發一個移動應用程序,其中包含需要確定用戶當前位置和從當前位置開始的部分,我想查找最近的位置。從我的當前位置獲取距離最近的位置
有沒有什麼辦法可以實現呢?
我已經做了一些編碼來找到用戶的當前位置。 這裏是我的代碼片段,
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:locationManager.location
completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!");
if (error){
NSLog(@"Geocode failed with error: %@", error);
return;
}
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(@"placemarks=%@",[placemarks objectAtIndex:0]);
但我的問題是,我將如何得到最近的其他地點?從我已經提取的當前位置。
在此先感謝。
去[此鏈接](http://stackoverflow.com/questions/17085668/how-to-find-nearest-latitude-and-longitude-form當前位置),這有類似的問題。我想這會幫助你。 – Suryakant