鹰眼轨迹分析类接口提供停留点分析和驾驶行为分析功能:
1. 停留点分析接口:一段轨迹中有多少个停留点、停留在何处、停留了多久
2. 驾驶行为分析:一段轨迹中有多少个超速点、急加/减速点、急转弯点,其中超速点功能支持依据百度地图路网实际道路限速计算,也支持开发者设置固定的限速值
注意:如使用轨迹分析相关接口,轨迹点上传时请务必同步上传speed(速度)和direction(方向)字段,否则该接口将不进行分析计算。鹰眼SDK在GPS定位下会自动采集这些数据。
模块 | 接口名称 | 功能说明 |
---|---|---|
analysis | staypoint | 停留点分析 |
drivingbehavior |
驾驶行为分析 |
目前中国主要有以下三种坐标系:
WGS84:为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。
GCJ02:是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。
BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标
非中国地区地图,统一使用WGS84坐标
鹰眼 Web服务API v3.0的默认输入输出参数为百度坐标(BD09),同时可通过"coord_type","coord_type_input","coord_type_output"(以各服务参数介绍为准)控制输入输出的坐标类型,鹰眼将自动完成转换。https://yingyan.baidu.com/api/v3/analysis/staypoint //GET 请求
参数名 | 参数含义 | 类型 | 是否必填 | 备注 |
---|---|---|---|---|
ak | 用户的AK,授权使用 | string | 是 | |
service_id | service的ID,作为其唯一标识 | Int | 是 | 在轨迹管理台创建鹰眼服务时,系统返回的 service_id |
entity_name | entity名称,作为其唯一标识。 | string(128) | 是 | |
start_time | 开始时间 | UNIX时间戳 | 是 | |
end_time | 结束时间 | UNIX时间戳 | 是 | |
stay_time | 停留时间 | int | 否 | 单位:秒,默认值:600。该字段用于设置停留点判断规则,即若系统判断在半径为stay_radius的圆形范围内停留时间超过stay_time,则被认为是一次停留 |
stay_radius | 停留半径 | int | 否 | 单位:米,取值范围:[1,500],默认值:20。该字段用于设置停留点判断规则,即若系统判断在半径为stay_radius的圆形范围内停留时间超过stay_time,则被认为是一次停留 |
process_option | 纠偏选项,用于控制返回坐标的纠偏处理方式 | string(0-128) | 否 | 默认值为: need_mapmatch=0,transport_mode=driving 取值规则为: 1.绑路,示例: need_mapmatch=0:不绑路 need_mapmatch=1:绑路 2.交通方式,鹰眼将根据不同交通工具选择不同的纠偏策略,目前支持驾车、骑行和步行,示例: transport_mode=driving transport_mode=riding transport_mode=walking |
coord_type_output | 返回的坐标类型 | string | 否 | 默认值:bd09ll
该字段用于控制返回结果中的坐标类型。可选值为: gcj02:国测局加密坐标 bd09ll:百度经纬度坐标 该参数仅对国内(包含港、澳、台)轨迹有效,海外区域轨迹均返回 wgs84坐标系 |
sn | 用户的权限签名,若用户所用AK的校验方式为SN校验时该参数必须。 SN计算规则 |
string | 否 |
参数名 | 参数含义 | 类型 | 备注 | ||
---|---|---|---|---|---|
status | 状态码 | int | 返回状态,0为成功 | ||
message | 响应信息 | string | 对status的中文描述 | ||
staypoint_num | 停留次数 | int | 本段行程中停留次数 | ||
stay_points | 停留记录列表 | array | 数组中每个元素代表一次停留,记录一个停留点坐标 | ||
start_time | 停留开始时间 | UNIX时间戳 | |||
end_time | 停留结束时间 | UNIX时间戳 | |||
duration | 停留时长 | int | 单位:秒 | ||
stay_point | 停留点 | dict | |||
longitude | 经度 | double | |||
latitude | 纬度 | double | |||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 |
https://yingyan.baidu.com/api/v3/analysis/staypoint?ak=用户的'''AK'''&service_id=用户的service_id&entity_name=car_plate&start_time=1467734400&end_time=1467817200&stay_time=300
{ status: 0, message: "成功", staypoint_num: 3, stay_points: [ { start_time: 1464164829, end_time: 1464166832, duration: 2003, stay_point: { longitude: 113.22167932597, latitude: 23.411219209009, coord_type: 3 } }, { start_time: 1464170138, end_time: 1464171664, duration: 1526, stay_point: { longitude: 113.20923398543, latitude: 23.411707425027, coord_type: 3 } }, { start_time: 1464172067, end_time: 1464172952, duration: 885, stay_point: { longitude: 113.207836, latitude: 23.40664, coord_type: 3 } } ] }
查询entity在指定时间段内的驾驶行为,返回以下分析结果:
1. 总体信息:起终点信息、里程、耗时、平均速度、最高速度
2. 异常信息:超速、急加速、急刹车、急转弯
https://yingyan.baidu.com/api/v3/analysis/drivingbehavior //GET请求
参数名 | 参数含义 | 类型 | 是否必填 | 备注 |
---|---|---|---|---|
ak | 用户的AK,授权使用 | string | 是 | |
service_id | service的ID,作为其唯一标识 | Int | 是 | 在轨迹管理台创建鹰眼服务时,系统返回的 service_id |
entity_name | entity名称,作为其唯一标识 | string(128) | 是 | |
start_time | 开始时间 | UNIX时间戳 | 是 | |
end_time | 结束时间 | UNIX时间戳 | 是 | 结束时间需大于开始时间,但不可大于超过24小时。为提升响应速度,同时避免轨迹点过多造成请求超时(3s)失败,建议缩短每次请求的时间区间,将一天拆分成多个时间段,对结果进行拼接 |
speeding_threshold | 固定限速值 | double | 否 | 默认值:0
取值规则: 0:根据百度地图道路限速数据计算超速点 其他数值:以设置的数值为阈值,轨迹点速度超过该值则认为是超速; 示例: speeding_threshold=0,以道路限速数据计算 speeding_threshold=80,限速值为80km/h |
harsh_acceleration_threshold | 急加速的加速度阈值 | double | 否 | 默认值:1.67,单位:m/s^2,仅支持正数 |
harsh_breaking_threshold | 急减速的加速度阈值 | double | 否 | 默认值:-1.67,单位:m/s^2,仅支持负数 |
harsh_steering_threshold | 急转弯的向心加速度阈值 | double | 否 | 默认值:5,单位:m/s^2,仅支持正数 |
process_option | 纠偏选项,用于控制返回坐标的纠偏处理方式,不填则按默认纠偏方式处理 | string(0-128) | 否 | 默认值为: need_mapmatch=0,transport_mode=driving 取值规则为: 1.绑路,示例: need_mapmatch=0:不绑路 need_mapmatch=1:绑路 2.交通方式,鹰眼将根据不同交通工具选择不同的纠偏策略,目前支持驾车、骑行和步行,示例: transport_mode=driving transport_mode=riding transport_mode=walking |
coord_type_output | 返回的坐标类型 | string | 否 | 默认值:bd09ll
该字段用于控制返回结果中的坐标类型。可选值为: gcj02:国测局加密坐标 bd09ll:百度经纬度坐标 该参数仅对国内(包含港、澳、台)轨迹有效,海外区域轨迹均返回 wgs84坐标系 |
sn | 用户的权限签名,若用户所用AK的校验方式为SN校验时该参数必须。 SN计算规则 |
string | 否 |
参数名 | 参数含义 | 类型 | 备注 | |||
---|---|---|---|---|---|---|
status | 状态码 | int | 返回状态,0为成功 | |||
message | 响应信息 | string | 对status的中文描述 | |||
distance | 行程里程 | double | 单位:米 | |||
duration | 行程耗时 | int | 单位:秒 | |||
average_speed | 平均时速 | double | 单位:km/h | |||
max_speed | 最高时速 | double | 单位:km/h | |||
speeding_num | 超速次数 | int | ||||
harsh_acceleration_num | 急加速次数 | int | ||||
harsh_breaking_num | 急刹车次数 | int | ||||
harsh_steering_num | 急转弯次数 | int | ||||
start_point | 起点信息 | |||||
longitude | 经度 | double | ||||
latitude | 纬度 | double | ||||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | |||
loc_time | 定位时间 | UNIX时间戳 | ||||
address | 起点地址 | |||||
end_point | 终点信息 | |||||
longitude | 经度 | double | ||||
latitude | 纬度 | double | ||||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | |||
loc_time | 定位时间 | UNIX时间戳 | ||||
address | 终点地址 | |||||
speeding | 超速记录集合 | array | 超速记录集合是一个数组,数组中的每一项代表一次超速记录 | |||
超速记录 | array | 超速记录本身是一个数组,数组中包括此次超速的起点和终点两个轨迹点。 | ||||
speeding_distance | 超速里程 | double | 单位:米。本次超速的里程 | |||
speeding_points | 超速点 | array | 一条超速记录中的超速起点或终点 | |||
longitude | 经度 | double | ||||
latitude | 纬度 | double | ||||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | |||
loc_time | 定位时间 | UNIX时间戳 | ||||
actual_speed | 实际行驶时速 | double | 单位:km/h | |||
limit_speed | 所在道路限定最高时速 | double | 单位:km/h | |||
harsh_acceleration | 急加速记录集合 | |||||
急加速记录 | array | |||||
longitude | 经度 | double | ||||
latitude | 纬度 | double | ||||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | |||
loc_time | 定位时间 | UNIX时间戳 | ||||
acceleration | 实际加速度 | double | 单位:m/s^2 | |||
initial_speed | 加速前时速 | double | 单位:km/h | |||
end_speed | 加速后时速 | double | 单位:km/h | |||
harsh_breaking | 急刹车记录集合 | |||||
急刹车记录 | array | |||||
longitude | 经度 | double | ||||
latitude | 纬度 | double | ||||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | |||
loc_time | 定位时间 | UNIX时间戳 | ||||
acceleration | 实际加速度 | double | 单位:m/s^2 | |||
initial_speed | 刹车前时速 | double | 单位:km/h | |||
end_speed | 刹车后时速 | double | 单位:km/h | |||
harsh_steering | 急转弯记录集合 | |||||
急转弯记录 | array | |||||
longitude | 经度 | double | ||||
latitude | 纬度 | double | ||||
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | |||
loc_time | 定位时间 | UNIX时间戳 | ||||
centripetal_acceleration | 向心加速度 | double | 单位:m/s^2 | |||
turn_type | 转向类型 | string | 取值范围:unknow(方向未知),left(左转),right(右转) | |||
speed | 转向时速 | double | 单位:km/h |
https://yingyan.baidu.com/api/v3/analysis/drivingbehavior?ak=<用户的'''AK>'''&service_id=用户的service_id&entity_name=car_plate&start_time=1464105600&end_time=1464191940&speeding_threshold=80
{ status: 0, message: "成功", distance: 79707.90026776, duration: 38441, average_speed: 7.4646455858052, max_speed: 56.7, start_point: { longitude: 113.2075, latitude: 23.40675, coord_type: "bd09ll", loc_time: 1464134680, address: "新景豪苑内,新凤凰酒店-休闲会所附近9米" }, end_point: { longitude: 113.208055, latitude: 23.406561, coord_type: "bd09ll", loc_time: 1464173121, address: "盛业行东南49米" }, speeding_num: 2, harsh_acceleration_num: 1, harsh_breaking_num: 1, harsh_steering_num: 1, speeding: [ { speeding_distance: 59.189285867195, speeding_points: [ { longitude: 113.20710875909, latitude: 23.39908060312, coord_type: "bd09ll", loc_time: 1464138828, actual_speed: 87.5, limit_speed: 60 }, { longitude: 113.20697265531, latitude: 23.399597906861, coord_type: "bd09ll", loc_time: 1464138843, actual_speed: 108.9, limit_speed: 80 } ] }, { speeding_distance: 989.53701539415, speeding_points: [ { longitude: 113.21499929275, latitude: 23.413317284437, coord_type: "bd09ll", loc_time: 1464141367, actual_speed: 32.4, limit_speed: 15 }, { longitude: 113.21692508544, latitude: 23.408488134541, coord_type: "bd09ll", loc_time: 1464141794, actual_speed: 16.2, limit_speed: 15 } ] } ], harsh_acceleration: [ { longitude: 113.21725316042, latitude: 23.412958154234, coord_type: "bd09ll", loc_time: 1464143029, acceleration: 2.75, initial_speed: 0, end_speed: 19.8 } ], harsh_breaking: [ { longitude: 113.2149819651, latitude: 23.411143610036, coord_type: "bd09ll", loc_time: 1464141265, acceleration: -2.25, initial_speed: 34.2, end_speed: 26.1 } ], harsh_steering: [ { longitude: 113.2399844062, latitude: 23.415216724914, coord_type: "bd09ll", loc_time: 1464158589, centripetal_acceleration: 5.0324216823668, turn_type: "left", speed: 36.44 } ] }