您当前的位置: iOS全景SDK > 开发指南 > 全景信息获取
全景信息获取

获取全景数据

为了让开发者获取更全面的全景信息,获取数据更加方便,全景SDK提供了相关全景数据获取。第一个接口是室内全景描述信息的获取。例如:走进一家酒店,可以根据此处的pid ,通过以下接口得到此酒店的内部全景信息。这其中还包括内景相册相关信息,内景相册是指酒店中不同区域的全景,例如大堂,厕所,客房等。

为了能够让开发者更好的理解根据POI获取全景相关的信息,SDK特意封装为对应的数据结构。

新增全景查询返回数据基类

@property (assign, nonatomic) double   x;
@property (assign, nonatomic) double   y;
@property (copy, nonatomic) NSString *type;
@property (copy, nonatomic)   NSString *sdkVersion;
@property (assign, nonatomic) int errorCode;
@property (copy, nonatomic)   NSString *desc;
@property (assign, nonatomic) BOOL     hasPanorama;

基于POI查询的全景返回数据类

@property (assign, nonatomic) double direction;
@property (copy, nonatomic)   NSString *pid;
@property (copy, nonatomic)   NSString *uid;
@property (copy, nonatomic)   NSString *iid;
@property (copy, nonatomic)   NSString *name;
@property (copy, nonatomic)   NSString *std_tag;
@property (assign, nonatomic) BOOL     hasStreet;
@property (assign, nonatomic) BOOL     hasInterior;

基于位置查询的全景返回数据类

@property (copy, nonatomic) NSString *pid;
@property (copy, nonatomic) NSString *roadName;
@property (copy, nonatomic) NSString *mode;
/**
 * @abstract 通过uid获取该poi下的全景描述信息,以此来判断此UID下是否有全景
 * @param    pid
 * @result   json string
 */
+ (BaiduPoiPanoData *)requestPanoramaInfoWithUid:(NSString *)uid;
/**
 * @abstract  通过墨卡托坐标获取坐标下全景的相关信息。
 * @param    墨卡托坐标 x  墨卡托坐标 y
 * @result   BaiduLocationPanoData
 */
+(BaiduLocationPanoData*)requestPanoramaInfoWithX:(double)x Y:(double)y;
/**
 * @abstract 通过经纬度获取经纬度下全景相关信息,例如pid,全景类型等
 * @param    pid
 * @result   BaiduLocationPanoData
 */
+(BaiduLocationPanoData*)requestPanoramaInfoWithLon:(double)lon Lat:(double)lat;

获取室内全景描述信息

/**
 * @abstract 获取室内全景描述信息
 * @param   pid 全景pid
      */
+ (NSString *)requestPanoramaIndoorDataWithPid:(NSString *)pid;

返回的Json 数据如下:

{
    "content": [
        {
            "interinfo": {
                "BreakID": "01002200001308170737146415C",
                "BreakX": 1292584839,
                "BreakY": 484668334,
                "D_ICON": 1,
                "D_STREET": 1,
                "D_UII": 1,
                "Defaultfloor": 0, --------------------- 默认楼层
                "Entrances": [--------------------- 内景的入口点信息
                    {
                        "BreakID": "01002200001308170737146415C",
                        "BreakX": 1292584839,
                        "BreakY": 484668334,
                        "EntranceName": "大觉寺",
                        "IsDefault": 1,
                        "Marker": {
                            "X": 1292582800,
                            "Y": 484668300
                        },
                        "UID": "465d2bc55c987ed7102935a0"
                    }
                ],
                "FileTag": "Inter_cfg",
                "Floors": [--------------------- 内景的楼层信息,以及楼层的单点信息
                    {
                        "Floor": 0,
                        "ImgHeight": 0,
                        "ImgWidth": 0,
                        "LTpoint": {
                            "X": 0,
                            "Y": 0
                        },
                        "Name": "floor_0",
                        "NorthDir": 180,
                        "Points": [
                            {
                                "PID": "0300220000131105191740485IN",
                                "Timeline": "2013",
                                "X": 1292581230,
                                "Y": 484668209,
                                "importance": 0,
                                "movedir": 196,
                                "name": "无量寿佛殿",
                                "northdir": 180,
                                "pin": 0,
                                "rank": 1,
                                "ugc": ""
                            },
                            {
                                "PID": "0300220000131105191733483IN",
                                "Timeline": "2013",
                                "X": 1292581230,
                                "Y": 484668209,
                                "importance": 0,
                                "movedir": 95,
                                "name": "迦陵舍利塔",
                                "northdir": 180,
                                "pin": 0,
                                "rank": 1,
                                "ugc": ""
                            },
                            {
                                "PID": "0300220000131105191736484IN",
                                "Timeline": "2013",
                                "X": 1292581230,
                                "Y": 484668209,
                                "importance": 0,
                                "movedir": 260,
                                "name": "大明敕谕碑",
                                "northdir": 180,
                                "pin": 0,
                                "rank": 1,
                                "ugc": ""
                            }
                        ],
                        "Scale": 0,
                        "StartID": "0300220000131105191740485IN"
                    }
                ],
                "HasImg": 0,
                "IID": "465d2bc55c987ed7102935a0",
                "IPoint": {
                    "X": 1292581200,
                    "Y": 484668200
                },
                "ImageType": 0,
                "Name": "大觉寺",
                "Parent": "",
                "Type": "inter",
                "UID": "465d2bc55c987ed7102935a0",
                "VPpoint": {
                    "X": 1292582800,
                    "Y": 484668300
                },
                "VPrank": 586
            },
            "panoinfo": {
                "Admission": "GS(2014)6066",
                "Date": "20131105",
                "DeviceHeight": 1.45,
                "Enters": [],
                "FileTag": "pano_cfg",
                "Heading": 90,
                "ID": "0300220000131105191740485IN",
                "ImgLayer": [
                    {
                        "BlockX": 2,
                        "BlockY": 1,
                        "ImgFormat": "jpg",
                        "ImgLevel": 1
                    },
                    {
                        "BlockX": 4,
                        "BlockY": 2,
                        "ImgFormat": "jpg",
                        "ImgLevel": 2
                    },
                    {
                        "BlockX": 8,
                        "BlockY": 4,
                        "ImgFormat": "jpg",
                        "ImgLevel": 3
                    },
                    {
                        "BlockX": 16,
                        "BlockY": 8,
                        "ImgFormat": "jpg",
                        "ImgLevel": 4
                    }
                ],
                "Inters": [
                    {
                        "BreakID": "01002200001308170737146415C",
                        "Floor": 0,
                        "IID": "465d2bc55c987ed7102935a0",
                        "Name": "大觉寺"
                    }
                ],
                "LayerCount": 4,
                "Mode": "day",
                "MoveDir": 196,
                "NorthDir": 180,
                "Photos": [--------------------- 相册信息
                    {
                        "Floor": 0,
                        "Name": "无量寿佛殿",
                        "PID": "0300220000131105191740485IN"
                    },
                    {
                        "Floor": 0,
                        "Name": "迦陵舍利塔",
                        "PID": "0300220000131105191733483IN"
                    },
                    {
                        "Floor": 0,
                        "Name": "大明敕谕碑",
                        "PID": "0300220000131105191736484IN"
                    }
                ],
                "Pitch": 0,
                "Provider": 4,
                "Rname": "大觉寺",
                "Roll": 0,
                "SwitchID": [],
                "Time": "2013",
                "Type": "inter",
                "Version": "0",
                "X": 1292581230,
                "Y": 484668209,
                "Z": 0,
                "format_v": "0",
                "plane": "",
                "procdate": "20140922"
            }
        }
    ],
    "result": {
        "error": 0
    }
}

获取全景pid周边所有的推荐服务信息

/**
 * @abstract 获取全景pid周边所有的推荐服务信息
 * @param   pid 全景pid
 */
+(NSString *)requestPanoramaRecommendationServiceDataWithPid:(NSString *)pid;

返回的Json 数据如下:

{
    "content": [
        {
            "Dir": 279.207, --------------视角朝向
            "Info": "出口", --------------全景名称
            "PID": "01002200001308261445121685X",  ------------全景pid
            "PanoX": 12955228,
            "PanoY": 4817158,
            "Pitch": 0,
            "Type": 3,
            "UID": "",
            "Weigh": 40,
            "X": 12955203,
            "Y": 4817158
        },
        {
            "Dir": 337,
            "Floor": 1,
            "Info": "美甲区",
            "PID": "0300220000131231101751974IN",
            "Pitch": 0,
            "Type": 1,
            "Weigh": 15,
            "X": 12955943,
            "Y": 4818040
        },
        {
            "Dir": 179,
            "Floor": 1,
            "Info": "正门",
            "PID": "0300220000131231101751975IN",
            "Pitch": 0,
            "Type": 1,
            "Weigh": 14,
            "X": 12955943,
            "Y": 4818040
        },
        {
            "Dir": 0,
            "Floor": 2,
            "Info": "大厅1",
            "PID": "0300220000131231101751971IN",
            "Pitch": 0,
            "Type": 1,
            "Weigh": 10,
            "X": 12955943,
            "Y": 4818040
        },
        {
            "Dir": 102,
            "Floor": 2,
            "Info": "大厅2",
            "PID": "0300220000131231101751972IN",
            "Pitch": 0,
            "Type": 1,
            "Weigh": 9,
            "X": 12955943,
            "Y": 4818040
        },
        {
            "Dir": 61,
            "Floor": 2,
            "Info": "包房",
            "PID": "0300220000131231101751970IN",
            "Pitch": 0,
            "Type": 1,
            "Weigh": 9,
            "X": 12955943,
            "Y": 4818040
        },
        {
            "Dir": 9,
            "Floor": 2,
            "Info": "大厅等待区",
            "PID": "0300220000131231101751973IN",
            "Pitch": 0,
            "Type": 1,
            "Weigh": 9,
            "X": 12955943,
            "Y": 4818040
        }
    ],
    "result": {
        "error": 0
    }
}