鹰眼轨迹服务 | 百度地图api sdk-凯发k8官方旗舰厅

浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。
简介

为 entity 上传轨迹点,支持为一个 entity上传一个或多个轨迹点,也支持为多个 entity 上传多个轨迹点。

接口列表
模块接口名称功能说明
trackaddpoint上传单个轨迹点
addpoints批量上传多个 entity 的多个轨迹点。与 v2版接口不同的是:
1. 轨迹点列表采用 json格式,而非.csv 文件;
2.一次请求可上传多个 entity 的轨迹点;
注:开发者可参照示例代码实现高并发批量上传轨迹点: 批量上传轨迹点的java源码和示例
坐标系说明

目前中国主要有以下三种坐标系:

wgs84:为一种大地坐标系,也是目前广泛使用的gps全球卫星定位系统使用的坐标系
gcj02:是由中国国家测绘局制订的地理信息系统的坐标系统。由wgs84坐标系经加密后的坐标系
bd09:为百度坐标系,在gcj02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标

非中国地区地图,统一使用wgs84坐标

数据合规性说明

开发者在百度地图鹰眼自行上传数据与百度地图开放平台无关,开发者应对上传数据的合法性负责,并确保不侵犯他人合法权益。若上传数据包含用户隐私信息,包括但不限于用户名、手机号、身份id等,请开发者确保已获取用户的授权同意并由开发者自行加密以保障用户隐私安全,百度地图开放平台不对开发者自行上传的用户数据进行校验和加密。

高并发上传轨迹点示例

为便于开发者从服务端上传轨迹,鹰眼提供了java版批量上传轨迹示例demo,供开发者参考。请前往: 相关下载

接口说明
addpoint——上传单个轨迹点

为一个entity上传一个轨迹点

请求url

https://yingyan.baidu.com/api/v3/track/addpoint
//post请求

请求参数
参数名称字段含义数据类型是否必填备注
ak

用户的ak

string
service_id

service的id,service 的唯一标识

int在轨迹管理台创建鹰眼服务时,系统返回的 service_id
entity_name

entity唯一标识

string(0-128)标识轨迹点所属的 entity
latitude

纬度

double(-90.0 , 90.0)
longitude

经度

double(-180.0 , 180.0)
loc_time

定位时设备的时间

unix时间戳输入的loc_time不能大于当前服务端时间10分钟以上,即不支持存未来的轨迹点。 且输入的loc_time不能小于当前服务端时间1年以上,即不支持存1年以前的轨迹点。
coord_type_input

坐标类型

string默认值:bd09ll 该字段用于描述上传的坐标类型。可选值为: wgs84:gps 坐标 gcj02:国测局加密坐标 bd09ll:百度经纬度坐标
speed

速度

double单位:km/h
direction

方向

int取值规则: 范围为[0,359],0度为正北方向,顺时针
height

高度

double单位:米
radius

定位精度,gps或定位sdk返回的值

double单位:米
object_name

对象数据名称

string通过鹰眼 sdk 上传的图像文件名称
column-key

track的自定义字段

此处值的类型须与用户自定义的column的类型一致 随轨迹点上传开发者自定义字段的值
sn

用户的权限签名,若用户所用ak的校验方式为sn校验时该参数必须。sn计算方法

string

返回值

参数名称字段含义数据类型备注
status

状态码

int返回状态,0为成功
message

响应信息

string对status的中文描述
请求示例
返回示例
{
"status":0,
"message":"成功",
}
addpoints——批量添加轨迹点

一次上传多个轨迹点.可上传一个 entity 的多个轨迹点,或多个entity的多个轨迹点,并且可以携带自定义字段的信息。

请求url

https://yingyan.baidu.com/api/v3/track/addpoints
//post 请求

请求参数
参数名称字段含义数据类型是否必填备注
ak

用户的ak,授权使用

string
service_id

service的id,service 的唯一标识

intservice 的唯一标识。在轨迹管理台创建鹰眼服务时,系统返回的 service_id
point_list

轨迹点列表

string(1-10000)轨迹点总数不超过100个,json 格式。轨迹点字段描述参见 addpoint 接口,其中 entity_name,latitude,longitude,loc_time,coord_type_input5个字段必填,其他字段可选
sn

用户的权限签名,若用户所用ak的校验方式为sn校验时该参数必须。sn计算方法

string

point_list 格式参考:(假设这个service已通过 添加过city和province两个自定义字段)

[
{
"entity_name":"京q8374w",
"loc_time":1525232703,
"latitude":39.989715,
"longitude":116.437039,
"coord_type_input":"wgs84",
"speed":27.23,
"direction":178,
"height":173.3,
"radius":32,
"object_name":"12836",
"city":"beijing",
"province":"beijing",
},
{
"entity_name":37286234,
"loc_time":1525232703,
"latitude":39.895895,
"longitude":116.235244,
"coord_type_input":"wgs84",
"speed":28.82,
"direction":174,
"height":173.6,
"radius":32,
"object_name":"12837",
"city":"beijing",
"province":"beijing"
}
]
返回值
参数名字段含义类型备注
status状态码int返回状态,0为成功
message响应信息string对status的中文描述
success_num上传成功的点个数int
fail_info上传失败的点信息dict
param_error输入参数不正确导致的上传失败的点array上传的point_list中,参数不符合规范的点,以及该点的错误信息(在"error"字段中返回)
internal_error服务器内部错误导致上传失败的点array 鹰眼服务端内部失败导致的上传失败的点
示例代码
填写您的ak

输入ak可生成包含ip/sn校验方式的代码

<?php
// 此处填写你在控制台-应用管理-创建应用后获取的ak
$ak ='您的ak';
// 发起一个http post请求,并返回请求的结果
// $url字段为请求的地址
// $param字段为请求的参数
functionrequest_post($url ='', $param =array()){
if(empty($url)||empty($param)){
returnfalse;
}
$curl =curl_init();// 初始化curl
curl_setopt($curl,curlopt_url, $url);// 设置指定url
curl_setopt($curl,curlopt_timeout,1000);// 设置超时时间1秒
curl_setopt($curl,curlopt_returntransfer,1);// curl不直接输出到屏幕
curl_setopt($curl,curlopt_header,0);// 设置header
// 以下两行不对https做证书及服务器校验,真实项目中请根据实际情况调整。
curl_setopt($curl,curlopt_ssl_verifypeer,0);
curl_setopt($curl,curlopt_ssl_verifyhost,0);
curl_setopt($curl,curlopt_post,1);// 设置post
curl_setopt($curl,curlopt_postfields, $param);
$data =curl_exec($curl);// 运行curl
if(!$data){
print("an error occured in function request_post(): ".curl_error($curl). "
");
}
curl_close($curl);
return $data;
}
// 请求地址
$url ='https://yingyan.baidu.com/api/v3/track/addpoints';
// 接口地址
$param['ak']= $ak;
$param['service_id']='您的service';
$param['point_list']='[{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589778,"longitude":116.34181,"latitude":40.07683},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589783,"longitude":116.343,"latitude":40.07683},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589788,"longitude":116.34349,"latitude":40.07682},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589793,"longitude":116.34364,"latitude":40.07682},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589798,"longitude":116.34382,"latitude":40.07682},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589803,"longitude":116.34484,"latitude":40.07681},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589808,"longitude":116.34496,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589813,"longitude":116.34534,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589818,"longitude":116.34605,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589823,"longitude":116.34627,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589828,"longitude":116.34627,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589833,"longitude":116.34626,"latitude":40.07687},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589838,"longitude":116.34626,"latitude":40.07687},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589843,"longitude":116.34626,"latitude":40.07715},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589848,"longitude":116.34626,"latitude":40.07721},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589853,"longitude":116.34627,"latitude":40.0775},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589858,"longitude":116.34627,"latitude":40.07766},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589863,"longitude":116.34627,"latitude":40.07786},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589868,"longitude":116.34627,"latitude":40.07795},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589873,"longitude":116.3463,"latitude":40.07837},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589878,"longitude":116.34634,"latitude":40.07848},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589883,"longitude":116.34635,"latitude":40.07889},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589888,"longitude":116.34635,"latitude":40.0791},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589893,"longitude":116.34637,"latitude":40.07971},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589898,"longitude":116.34638,"latitude":40.08037},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589903,"longitude":116.34639,"latitude":40.08119},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589908,"longitude":116.34639,"latitude":40.08125},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589913,"longitude":116.34639,"latitude":40.08125},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589918,"longitude":116.34665,"latitude":40.08125},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589923,"longitude":116.3481,"latitude":40.08124},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589928,"longitude":116.3481,"latitude":40.08124},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589933,"longitude":116.34839,"latitude":40.08124},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589938,"longitude":116.34847,"latitude":40.08124},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589943,"longitude":116.34927,"latitude":40.08123},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589948,"longitude":116.35036,"latitude":40.08123},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589953,"longitude":116.35127,"latitude":40.08123},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589958,"longitude":116.35127,"latitude":40.08123},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589963,"longitude":116.35135,"latitude":40.08115},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589968,"longitude":116.35146,"latitude":40.08104},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589973,"longitude":116.35146,"latitude":40.08043},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589978,"longitude":116.35146,"latitude":40.08036},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589983,"longitude":116.35146,"latitude":40.08015},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589988,"longitude":116.35146,"latitude":40.08004},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589993,"longitude":116.35145,"latitude":40.07956},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687589998,"longitude":116.35145,"latitude":40.07919},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590003,"longitude":116.35142,"latitude":40.07852},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590008,"longitude":116.35141,"latitude":40.07825},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590013,"longitude":116.35143,"latitude":40.07709},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590018,"longitude":116.35143,"latitude":40.07706},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590023,"longitude":116.35143,"latitude":40.07688},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590028,"longitude":116.35143,"latitude":40.07688},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590033,"longitude":116.35144,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590038,"longitude":116.35144,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590043,"longitude":116.35152,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590048,"longitude":116.35163,"latitude":40.07681},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590053,"longitude":116.35661,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590058,"longitude":116.35683,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590063,"longitude":116.35694,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687590068,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575378,"longitude":116.34181,"latitude":40.07683},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575383,"longitude":116.343,"latitude":40.07683},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575388,"longitude":116.34349,"latitude":40.07682},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575393,"longitude":116.34364,"latitude":40.07682},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575398,"longitude":116.34382,"latitude":40.07682},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575403,"longitude":116.34484,"latitude":40.07681},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575408,"longitude":116.34496,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575413,"longitude":116.34534,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575418,"longitude":116.34605,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575423,"longitude":116.34627,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575428,"longitude":116.34649,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575433,"longitude":116.35112,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575438,"longitude":116.35144,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575443,"longitude":116.35152,"latitude":40.0768},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575448,"longitude":116.35163,"latitude":40.07681},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575453,"longitude":116.35661,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575458,"longitude":116.35683,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575463,"longitude":116.35694,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575468,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575483,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575493,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575503,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575513,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575523,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575533,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575543,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575553,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575563,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575573,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575583,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575593,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575603,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575613,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575623,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575633,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575643,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575653,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575663,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575673,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575683,"longitude":116.35695,"latitude":40.07679},{"entity_name":"entity_1","coord_type_input":"bd09ll","loc_time":1687575693,"longitude":116.35695,"latitude":40.07679}]';
// 只支持x-www-form-urlencoded格式的请求
$param =http_build_query($param);
// 发送请求
$res =request_post($url, $param);
// 将原始返回的结果打印出来
print("请求的原始返回结果为:
");
print($res . "
");
?>

注意:拷贝示例代码后,请在代码中填入您的serviceid再运行;

请求示例
返回示例
{
"status":0,
"message":"成功",
"success_num":1,
"total":2,
"fail_info":{
"param_error":[
{
"entity_name":37286234,
"loc_time":1525232703,
"latitude":39.895895,
"longitude":116.235244,
"coord_type_input":"wgs84",
"speed":28.82,
"direction":174,
"height":173.6,
"radius":32,
"object_name":"12837",
"city":"beijing",
"province":"beijing",
"error":"entity_name 类型不匹配"
}
],
"internal_error":[]
}
}

上一篇

空间搜索

下一篇

轨迹查询和纠偏

本篇文章对您是否有帮助?

网站地图