利用高德地圖poi檢索,模仿微信發朋友圈選擇附近位置
仿微信獲取附近的地標
該demo基于高德地圖poi檢索,需要自己注冊一個key,高德key申請
主要代碼
AMapPOIAroundSearchRequest *request = [[AMapPOIAroundSearchRequest alloc] init]; request.location = [AMapGeoPoint locationWithLatitude:23.107307 longitude:113.384098]; request.keywords = @""; request.sortrule = 0; request.requireExtension = YES; request.radius = 1000; request.page = self.pageIndex; request.offset = self.pageCount; request.types = @"050000|060000|070000|080000|090000|100000|110000|120000|130000|140000|150000|160000|170000"; [self.search AMapPOIAroundSearch:request];
以上代碼段用于發起檢索請求,獲取周邊的數據
#pragma mark - AMapSearchDelegate - (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response{ if (response.pois.count == 0){ return; } for(AMapPOI *poi in response.pois){ NSLog(@"%@",poi.name); } }
以上是獲取到數據的回調,在此可以獲取周邊信息.
使用配置
2.填寫Bundle Indentifie (需與高德申請的安全碼一致)
本文由用戶 ncnf 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!