逆地理编码 API

将经纬度坐标转换为详细地址描述。

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=gcj02

查询 params 参数含义:

参数 类型 必填 说明
access_key String 申请的应用 KEY,访问接口权限
response_sprf String 结果坐标返回需要的坐标系,默认 gcj02, 可填写 “gcj02”, ”wgs84”,”bd09”

请求BODY 参数:

参数 类型 必填 说明
asset String 设备 ID, 可通过 UUID 生成
location Location 定位请求数据
timestamp Number 定位数据收集的时间戳(UTC 时间,单位:毫秒)
id String 随机生成定位请求的 UUID

Location字段如下

参数名 类型 必填 说明
timestamp number 定位结果获得的时间戳,单位:毫秒
position Position 坐标点信息
spatialReference string 坐标系,当前经纬度坐标系。默认 gcj02, 可填写 “gcj02”, ”wgs84”,”bd09”
accuracy number 定位结果的精度值,单位:米

Position字段如下

参数 类型 是否必须 说明
longitude number 经度
latitude number 纬度

调用 WAYZ 的 API,需要提前获取 KEY 信息。

请求示例如下:

{
  "asset": "device-001",
  "location": {
    "position": {
      "point": {
        "longitude": 121.60441,
        "latitude": 31.179716
      },
      "spatialReference": "gcj02"
    }
  }
}

2.2返回参数

返回参数如下:

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

Location 字段如下

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

Address 字段如下

参数 类型 说明
name String 当前定位地址的格式化全称
level Number 定位地址所能达到的层级,参考列表见附录
context Array<Context> 格式化地址的组成部分

Context 字段如下

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

Place 字段如下

参数 类型 说明
id String 当前 place 的 placeId
name String 对应的 POI 名称
type String 当前场景的属性信息,例如:"Entity" 等
categories Array<Category> 如果对应 POI 存在类型分类,则提供类别信息
distance Distance 距离信息

Category 字段如下

参数 类型 说明
id Number 分类对应的 id
name String 分类对应的名称

Distance 字段如下

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

Position字段如下

参数 类型 说明
timestamp Number 定位结果获得的时间戳,单位:毫秒
point Point Point坐标点信息
source String 定位源信息,可能值有"wifi", "cell","gnss", "ip"
accuracy Number 定位结果的精度值,单位:米
spatialReference String 坐标点所属的空间坐标系,默认 "gcj02"。有"gcj02","bd09","wgs84"
confidence Number 定位结果的置信值

Point 字段如下

参数 类型 说明
longitude Number 经度
latitude Number 纬度
altitude Number 高程信息,单位:米

完整返回信息参数如下:

{
  "id": "76ff9c2d-73a1-11f1-ab29-aa8918cc720e",
  "asset": "device-001",
  "location": {
    "address": {
      "name": "上海市浦东新区张江镇祥科路炬创芯研发大楼",
      "context": [
        {
          "type": "Country",
          "name": "中国",
          "code": "CN"
        },
        {
          "type": "Province",
          "name": "上海市",
          "code": "310000"
        },
        {
          "type": "City",
          "name": "上海市",
          "code": "310100"
        },
        {
          "type": "District",
          "name": "浦东新区",
          "code": "310115"
        },
        {
          "type": "Township",
          "name": "张江镇",
          "code": "310115125"
        }
      ]
    },
    "place": {
      "type": "Entity",
      "name": "维智科技",
      "distance": {
        "line": 4.4931
      }
    },
    "position": {
      "point": {
        "longitude": 121.60441,
        "latitude": 31.179716
      },
      "spatialReference": "gcj02"
    }
  }
}

2.3报错信息

错误参数 说明
400 参数异常
401 API 密钥认证失败
403 Appkey 权限异常
404 无法解析
429 流量超出限制
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 道路 上海市浦东新区金科路
10 HouseNumber 门牌号 朝阳区阜通东大街6 号
11 Building 建筑 炬芯研发大楼A 幢