1 概述

提供融合定位等接口。协议默认规格有:

1、 时间戳为 int64,采用 unix 时间戳(Unix epoch),单位为毫秒;

2、 字符串都为 UTF8 格式;

3、 HTTP Headers:Content-Type 设置为:application/json

鉴权方式:

采用 access_key 的方式,在 URL 的 Query Param 中添加 access_key。

2 融合定位接口

2.1 请求参数

定位结果的获取,通过POST 请求下面的 URL :

https://api.newayz.com/location/hub/v1/track_points?access_key={YOUR_ACCESS_KEY}&response_sprf=wgs84

查询 params 参数含义:

参数 类型 必填 说明
access_key string 申请的应用 KEY,访问接口权限
response_sprf string 返回坐标系格式默认gcj02,三种格式(gcj02,wgs84,bd09)
needAddress boolean 定位结果中是否返回地址信息,默认是 ture,有地址信息返回

调用 WAYZ 的 API,需要提前获取 KEY 信息。请求参数如下:

参数 类型 必填 说明
timestamp int64 定位数据收集的时间戳(UTC 时间,单位:毫秒)
id string 随机生成定位请求的 UUID
asset Asset 设备相关信息
location Location 定位请求数据

Asset 设备信息参数如下

名称 类型 必填 说明
id string 设备 ID,使用用户自定义的值,如 UUID;需要保证同一 设备 id 不变,不同设备 id 不能重复
manufacturer string 设备制造厂商名称
model string 设备型号
imeiMd5 string 设备 IMEI 号的 MD5 值
macAddress string 设备网卡的 MAC 地址
serialNumber string 设备的序列号
uniqueId string 系统提供的唯一码,Android 系统的 android_id,iOS 系统 的 IDFA
os OS 设备的操作系统信息

OS 参数如下

名称 类型 必填 说明
type string 手机系统名称
version string 系统的版本信息,Android 系统的话,只填写原生系统版本即可

Location 字段如下

参数 类型 必填 说明
gnss Gnss 请求中的卫星信息
wifis Array<Wifi> 设备扫描到的周围的 WiFi 信息
cellulars Array<Cellular> 设备扫描到的周围的基站信息
bluetooths Array<Bluetooth> 设备扫描到的周围的蓝牙信息

Gnss参数如下

参数 类型 必填 说明
timestamp int64 数据收集的时间戳(UTC 时间,单位:毫秒)
point.longitude double 经度
point.latitude double 纬度
point.altitude float 高程,单位:米
accuracy float 卫星定位水平精度,单位:米
verticalAccuracy float 卫星定位垂直精度,单位:米
velocity float 速度,单位:米/秒
velocityAccuracy float 速度精度,单位:米/秒
heading int32 方向,单位:度,从北开始,顺时针 0~360 度

Cellular参数如下

参数 类型 必填 说明
timestamp int64 扫描到该基站时的时间戳(UTC 时间)
cellId int32 小区 ID,当 CDMA 时,为 BID(Base Station ID)编码范围:0-65535,0-268435455,小区编号大于 65535 时为 3G 基站
connected bool 设备是否为主基站,多基站定位时不填写会影响定位效果
signalStrength int32 信号强度,单位为:-dBm, 取值范围:0 到-113dbm。即取真实信号强度的绝对值
radioType string 基站类型,只能是以下值:gsm, wcdma, lte, cdma,nr
mobileCountryCode int32 MCC 码
mobileNetworkCode int32 当 CDMA 时,为 SID(System ID)码
locationAreaCode int32 当 CDMA 时,为 NID(Network ID);当 LTE 时,为 TAC(Tracking Area code)取值范围:0-65535

WIFI 参数如下

参数 类型 必填 说明
macAddress string 设备网卡的 MAC 地址
ssid string WiFi 的 ssid 名称,注意:JSON 编码时需要进行转义编码
signalStrength int32 信号强度,单位为:-dBm,即取真实信号强度的绝对值
frequency int32 指定通道下的频率,单位: MHz
channel int32 WiFi 子频段的通道编号
connected bool 设备是否已连接在该 AP 下,如果是"False"则可以省略此字段

当请求体中有且仅有 WiFi 信息列表时,提供至少4 个 WiFi 信息,才能获得定位结果。如果要更准确且稳定的服务,请至少提供10 个 WiFi 信息,以确保定位的成功率和准确性。

整体请求示例如下:

{
    "timestamp": 1515743846505,
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
    "asset": {
        "id": "390928a0-06d4-11e9-a952-024cxxxxxxxx",
        "manufacturer": "xiaomi",
        "model": "Note",
        "imeiMd5": "234567890",
        "macAddress": "1a:2b:3c:4d:5e:6f",
        "serialNumber": "xxxxxxxx",
        "uniqueId": "xxxxxxxx",
        "os": {
            "type": "Android",
            "version": "MI UI 9.6"
        }
    },
    "location": {
        "timestamp": 1515743846504,
        "gnss": {
            "timestamp": 1515743846504,
            "point": {
                "longitude": 116.248634,
                "latitude": 36.334663,
                "altitude": 34.54
            },
            "accuracy": 25,
            "velocity": 3.2,
            "heading": 0
        },
        "cellulars": [
            {
                "timestamp": 1515743846504,
                "cellId": 12338443,
                "connected": true,
                "signalStrength": 97,
                "radioType": "lte",
                "mobileCountryCode": 460,
                "mobileNetworkCode": 1,
                "locationAreaCode": 6380
            },
            {
                "timestamp": 1515743846504,
                "cellId": 12338443,
                "signalStrength": 97,
                "radioType": "lte",
                "mobileCountryCode": 460,
                "mobileNetworkCode": 1,
                "locationAreaCode": 6380
            }
        ],
        "wifis": [
            {
                "signalStrength": 43,
                "macAddress": "88:25:93:6f:df:bb",
                "connected": true
            },
            {
                "signalStrength": 43,
                "macAddress": "94:77:2b:65:1a:00"
            },
            {
                "signalStrength": 57,
                "macAddress": "88:25:93:6f:df:ba"
            },
            {
                "signalStrength": 60,
                "macAddress": "94:77:2b:65:1a:04"
            },
            {
                "signalStrength": 60,
                "macAddress": "d4:68:ba:03:34:b8"
            },
            {
                "signalStrength": 70,
                "macAddress": "a8:0c:ca:81:76:86"
            },
            {
                "signalStrength": 70,
                "macAddress": "a8:0c:ca:89:76:86"
            },
            {
                "signalStrength": 71,
                "macAddress": "a8:0c:ca:99:76:86"
            },
            {
                "signalStrength": 71,
                "macAddress": "a8:0c:ca:91:76:86"
            },
            {
                "signalStrength": 71,
                "macAddress": "a8:0c:ca:91:76:86"
            }
        ]
    }
}

2.2 返回参数

返回参数如下:

参数 类型 说明
id string 随机生成定位请求的 UUID
asset string 设备 ID,根据请求的设备 ID
location Location 定位的结构化位置信息

Location 字段如下

参数 类型 说明
timestamp int64 定位请求的时间戳,单位:毫秒
address Address 结构化地址信息
place Place 定位 POI 信息
position Position 定位的坐标信息

Address 字段如下

参数 类型 说明
name string 当前定位地址的格式化全称
context Array<Context> 格式化地址的组成部分

Context 字段如下

参数 类型 说明
code string 格式化地址层级对应的代码
name string 格式化地址层级对应的名称
type string 格式化地址层级对应的类型,可能的值包 括 : "Country","Province","City","District" , "Township","Road","Housenumber","Bounding area","Building"

Place 字段如下

| 参数 | 类型 | 说明 | | --- | --- | --- | --- | | name | string | 对应的 POI 名称 | | type | string | 当前场景的属性信息,例如:"Entity" 等 | | distance | Distance | 距离对象 |

Distance 字段如下

参数 类型 说明
line Double 定位结果坐标点到poi 坐标点的直线距离,单位:米

Position 字段如下

参数 类型 说明
timestamp int64 定位结果获得的时间戳,单位:毫秒
point Point 坐标点信息
spatialReference string 坐标点的空间坐标系,默认 "gcj02"
source string 定位源信息,可能值有"wifi", "cell", "gnss"
accuracy float 定位结果的精度值,单位:米

Point 字段如下

参数 类型 说明
longitude double 经度
latitude double 纬度

完整返回信息参数如下:

{
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
    "asset": "390928a0-06d4-11e9-a952-024cxxxxxxxx",
    "location": {
        "timestamp": 1515743846504,
        "address": {
            "name": "上海市上海市浦东新区张江镇祥科路58 号",
            "context": [
                {
                    "type": "Country",
                    "name": "中国",
                    "code": "CN"
                },
                {
                    "type": "Province",
                    "name": "上海市",
                    "code": "310000"
                },
                {
                    "type": "City",
                    "name": "上海市",
                    "code": "310000"
                },
                {
                    "type": "District",
                    "name": "浦东新区",
                    "code": "310115"
                },
                {
                    "type": "Township",
                    "name": "张江镇",
                    "code": "310115125"
                }
            ]
        },
        "place": {
            "type": "Entity",
            "name": "民防工程(炬芯研发大楼项目地下车库民防工程)",
            "distance": {
                "line": 3.7579
            }
        },
        "position": {
            "timestamp": 1730790836549,
            "source": "wifi",
            "point": {
                "longitude": 121.604634,
                "latitude": 31.179703
            },
            "spatialReference": "gcj02",
            "accuracy": 30
        }
    }
}

2.3 报错信息

错误参数 说明
400 参数异常
401 Appkey非法或不存在
403 Appkey 权限异常
404 无法解析
529 请求次数超额
500 服务器异常

400 报错信息

{
    "code": "400",
    "message": "no refdata provided"
}

401 报错信息

{
    "code": "401",
    "message": "No API key found in request"
}

403 报错信息

{

    "code": "403",
    "message": "Access key forbidden"
}

404 报错信息

{
    "code": "404",
    "message": "scenario not found"
}

429 报错信息

{
    "code": "429",
    "message": "API rate limit exceeded"
}

3 Address Model 级别说明

Level Field Type Description 示例说明
1 Country 国家 中国
2 Province/State 河北省、北京市
3 City 宁波市
4 District 区县 北京市朝阳区
5 Township 乡镇,街道 回龙观镇
6 Neighborhood 村庄,居委,乡 三元村
9 Road 道路 上海市浦东新区金科路
11 HouseNumber 门牌号 朝阳区阜通东大街6 号
13 Building 建筑 炬芯研发大楼A 幢