常见功能:后台传入经纬度,前台展示poi,有时候要逆地理编码出poi的各项信息,按照瀑布流的功能做法。
/// pod搜索库
pod 'AMapSearch', '~> 7.1.0' #高德地图搜索SDK
#import
/// 遵循协议
AMapSearchDelegate
/// 设置key
[AMapServices sharedServices].apiKey = @"xxx";
/// 实例化搜索对象,开启搜索反编码
_search = [[AMapSearchAPI alloc] init];
_search.delegate = self;
AMapReGeocodeSearchRequest *regeoReq = [[AMapReGeocodeSearchRequest alloc] init];
regeoReq.location = [AMapGeoPoint locationWithLatitude:latitude longitude:longitude];
regeoReq.requireExtension = YES;
[self.search AMapReGoecodeSearch:regeoReq];
/// 实现协议
- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response {
一般常用的信息,显示名称和地址
/// 名称
/// 地址
根据response .regeocode里面的返回值来显示:
有 NSArray
没有NSArray
}
////// 根据返回的地理信息,一目了然。
///逆地理编码返回
@interface AMapReGeocodeSearchResponse : AMapSearchObject
///逆地理编码结果
@property (nonatomic, strong) AMapReGeocode *regeocode;
@end
///逆地理编码
@interface AMapReGeocode : AMapSearchObject
///格式化地址
@property (nonatomic, copy) NSString *formattedAddress;
///地址组成要素
@property (nonatomic, strong) AMapAddressComponent *addressComponent;
///道路信息 AMapRoad 数组
@property (nonatomic, strong) NSArray
///道路路口信息 AMapRoadInter 数组
@property (nonatomic, strong) NSArray
///兴趣点信息 AMapPOI 数组
@property (nonatomic, strong) NSArray
///兴趣区域信息 AMapAOI 数组
@property (nonatomic, strong) NSArray
@end
///地址组成要素
@interface AMapAddressComponent : AMapSearchObject
///国家(since 5.7.0)
@property (nonatomic, copy) NSString *country;
///省/直辖市
@property (nonatomic, copy) NSString *province;
///市
@property (nonatomic, copy) NSString *city;
///城市编码
@property (nonatomic, copy) NSString *citycode;
///区
@property (nonatomic, copy) NSString *district;
///区域编码
@property (nonatomic, copy) NSString *adcode;
///乡镇街道
@property (nonatomic, copy) NSString *township;
///乡镇街道编码
@property (nonatomic, copy) NSString *towncode;
///社区
@property (nonatomic, copy) NSString *neighborhood;
///建筑
@property (nonatomic, copy) NSString *building;
///门牌信息
@property (nonatomic, strong) AMapStreetNumber *streetNumber;
///商圈列表 AMapBusinessArea 数组
@property (nonatomic, strong) NSArray
@end
///POI
@interface AMapPOI : AMapSearchObject
///POI全局唯一ID
@property (nonatomic, copy) NSString *uid;
///名称
@property (nonatomic, copy) NSString *name;
///兴趣点类型
@property (nonatomic, copy) NSString *type;
///类型编码
@property (nonatomic, copy) NSString *typecode;
///经纬度
@property (nonatomic, copy) AMapGeoPoint *location;
///地址
@property (nonatomic, copy) NSString *address;
///电话
@property (nonatomic, copy) NSString *tel;
///距中心点的距离,单位米。在周边搜索时有效
@property (nonatomic, assign) NSInteger distance;
///停车场类型,地上、地下、路边
@property (nonatomic, copy) NSString *parkingType;
///商铺id
@property (nonatomic, copy) NSString *shopID;
///邮编
@property (nonatomic, copy) NSString *postcode;
///网址
@property (nonatomic, copy) NSString *website;
///电子邮件
@property (nonatomic, copy) NSString *email;
///省
@property (nonatomic, copy) NSString *province;
///省编码
@property (nonatomic, copy) NSString *pcode;
///城市名称
@property (nonatomic, copy) NSString *city;
///城市编码
@property (nonatomic, copy) NSString *citycode;
///区域名称
@property (nonatomic, copy) NSString *district;
///区域编码
@property (nonatomic, copy) NSString *adcode;
///地理格ID
@property (nonatomic, copy) NSString *gridcode;
///入口经纬度
@property (nonatomic, copy) AMapGeoPoint *enterLocation;
///出口经纬度
@property (nonatomic, copy) AMapGeoPoint *exitLocation;
///方向
@property (nonatomic, copy) NSString *direction;
///是否有室内地图
@property (nonatomic, assign) BOOL hasIndoorMap;
///所在商圈
@property (nonatomic, copy) NSString *businessArea;
///室内信息
@property (nonatomic, strong) AMapIndoorData *indoorData;
///子POI列表
@property (nonatomic, strong) NSArray
///图片列表
@property (nonatomic, strong) NSArray
///扩展信息只有在ID查询时有效
@property (nonatomic, strong) AMapPOIExtension *extensionInfo;
@end