(未显示1个用户的118个中间版本) | |||
第5行: | 第5行: | ||
<div class="interiorLI">服务文档</div> | <div class="interiorLI">服务文档</div> | ||
<div class="interiorLI">使用指南</div> | <div class="interiorLI">使用指南</div> | ||
− | |||
<div class="interiorLI">更新日志</div> | <div class="interiorLI">更新日志</div> | ||
− | |||
</div> | </div> | ||
</div> | </div> | ||
第15行: | 第13行: | ||
<div class="navRemark"><div class="handpointto">服务介绍</div></div> | <div class="navRemark"><div class="handpointto">服务介绍</div></div> | ||
<div class="txtstyle2"> | <div class="txtstyle2"> | ||
− | <div class="bluetitle"><div class="services-title-text"> | + | <div class="bluetitle"><div class="services-title-text">轨迹纠偏服务</div></div> |
− | <div class="serve-explain-text">轨迹纠偏服务(又名Trackrectify API)是一类Web | + | <div class="serve-explain-text">轨迹纠偏服务(又名Trackrectify API)是一类Web API接口服务,用于纠正一段或多段轨迹的漂移,通过去除噪点、绑路、补充道路形状点、抽稀等方式,还原真实轨迹。<br/><br/>通常各种定位方式都存在着一定的误差,GPS信号不好的时候(例如,楼宇密集处、高架桥下、隧道等),可能就会使用WIFI或基站定位,特别是当周边WIFI热点比较少的时候会使用基站定位,定位误差会有所加大,产生轨迹漂移的现象。<br/><br/>为了纠正轨迹漂移,提升轨迹和里程的准确性,轨迹纠偏API提供了高性能的轨迹纠偏和绑路服务,其特性如下:<br/> |
+ | <br/>1. 高性能:一次请求支持对2000个轨迹点(轨迹里程不超过500公里)进行批量纠偏处理<br/><br/>2. 可配置:开放多种纠偏因子供开发者自行调节<br/><br/>3. 适用性:针对驾车、骑行和步行不同出行模式执行对应的轨迹纠偏策略,并针对停留点漂移进行了单独识别与处理,故对于移动和停留期间的轨迹均有优异的纠偏效果<br/><br/> | ||
+ | |||
+ | |||
+ | 说明1:轨迹纠偏API与鹰眼中的纠偏能力和效果一致,用于满足只对轨迹纠偏有需求,而不需进行轨迹存储的用户。开发者可根据自己的场景灵活选择鹰眼和轨迹纠偏API。<br/><br/> | ||
+ | |||
+ | 说明2:轨迹纠偏API于2018年7月23日上线,在此之前注册的AK默认无使用权限。若在此之前注册的AK需使用该服务,请进入[http://lbsyun.baidu.com/apiconsole/key API控制台]为AK勾选“轨迹纠偏API”即可正常使用。</div> | ||
<div class="bluetitle"><div class="services-title-text">功能介绍</div></div> | <div class="bluetitle"><div class="services-title-text">功能介绍</div></div> | ||
<div class="serveintor-min"> | <div class="serveintor-min"> | ||
<div class="serveintortxt"> | <div class="serveintortxt"> | ||
<div class="serveintorleft"> | <div class="serveintorleft"> | ||
− | <div class="serveintoor-title"> | + | <div class="serveintoor-title">轨迹纠偏API</div> |
− | <div class="serve-explain-text"> | + | <div class="serve-explain-text">用于对一段连续长轨迹进行纠偏绑路、计算里程、返回道路等级和道路限速信息,如:对一辆车一个行程或一天的轨迹进行<br/><br/>纠偏并计算里程。</div> |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</div> | </div> | ||
+ | <div class="serveintorright">http://mapopen-pub-yingyan.gz.bcebos.com/trackrectify%2Fguide.png</div> | ||
</div> | </div> | ||
</div> | </div> | ||
第37行: | 第38行: | ||
<div class="txtstyle2"> | <div class="txtstyle2"> | ||
<div class="bluetitle"><div class="services-title-text">接口功能介绍</div></div> | <div class="bluetitle"><div class="services-title-text">接口功能介绍</div></div> | ||
− | <div class="serve-explain-text"><div class="serveintoor-title service-page-anchor"> | + | <div class="serve-explain-text"><div class="serveintoor-title service-page-anchor">轨迹纠偏</div><div class="code-template"><pre class="get-url-pre">https://api.map.baidu.com/rectify/v1/track? //POST请求</pre></div></div> |
− | + | <div class="separate-title">请求参数</div> | |
{| | {| | ||
|- | |- | ||
! width="100" | 参数名 | ! width="100" | 参数名 | ||
− | ! width=" | + | ! width="200" | 参数含义 |
− | ! width=" | + | ! width="100" | 类型 |
− | ! width=" | + | ! width="100" | 是否必填 |
− | ! width=" | + | ! width="400" | 备注 |
|- | |- | ||
| ak | | ak | ||
− | | | + | | 用户的AK,授权使用 |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
| string | | string | ||
| 是 | | 是 | ||
第61行: | 第56行: | ||
| point_list | | point_list | ||
| 轨迹点序列 | | 轨迹点序列 | ||
− | | string(1- | + | | string(1-1M) |
| 是 | | 是 | ||
− | | | + | |最多不能超过2000个轨迹点,且轨迹里程不超过500公里(注:若轨迹里程超长,可能会出现响应时间过长或超时)。point_list格式为json, 其中每个point必须包含:latitude,longitude,coord_type_input,loc_time这4个字段,可选speed,direction,height,radius这4个字段,其他字段会被舍弃。 <br/>取值规则:<br/> latitude:纬度,支持小数点后6位<br/>longitude:经度,支持小数点后6位<br/>coord_type_input:轨迹点的坐标系,支持以下值:bd09ll(百度经纬度坐标)、gcj02(国测局加密坐标)、wgs84(GPS所采用的坐标系)<br/>loc_time:轨迹点的定位时间,使用UNIX时间戳(秒级)<br/>speed:轨迹点的速度,double类型,单位:公里/小时<br/>direction:轨迹点的方向,int类型,单位:范围为[0,359],0度为正北方向,顺时针方向递增<br/>height:轨迹点的高度,double类型,单位:米<br/>radius:定位时返回的定位精度,double类型,单位:米 |
|- | |- | ||
|rectify_option | |rectify_option | ||
第69行: | 第64行: | ||
|string(0-128) | |string(0-128) | ||
|否 | |否 | ||
− | |支持以下配置项,多个项之间用”| | + | |支持以下配置项,多个项之间用”|”竖线相隔。默认值为:need_mapmatch:1|transport_mode:auto|denoise_grade:1|vacuate_grade:1<br/> |
− | + | 取值规则为:<br/><br/> | |
− | + | ||
− | + | ||
− | + | 1. need_mapmatch(绑路)<br/><br/> | |
− | + | 是否需要将轨迹点绑路并补充道路形状点 ,示例:<br/><br/> | |
+ | need_mapmatch:0 不绑路<br/><br/> | ||
+ | need_mapmatch:1 绑路<br/><br/> | ||
− | + | 2. transport_mode(交通方式)<br/><br/> | |
− | + | 根据不同交通工具选择不同的纠偏策略和参数,目前支持:自动(即鹰眼自动识别的交通方式)、驾车、骑行和步行。示例:<br/><br/> | |
− | + | transport_mode:auto<br/><br/> | |
+ | transport_mode:driving<br/><br/> | ||
+ | transport_mode:riding<br/><br/> | ||
+ | transport_mode:walking<br/><br/> | ||
− | 4. vacuate_grade(抽稀力度) | + | 3. denoise_grade(去噪力度)<br/><br/> |
− | 取值范围[0,5] | + | 取值范围[0,5],数值越大去噪力度越大,代表越多的点会被当做噪点去除。若取值0,则代表不去噪。示例:<br/><br/> |
+ | denoise_grade:0 (不去噪)<br/><br/> | ||
+ | denoise_grade:1 (系统默认去噪)<br/><br/> | ||
+ | denoise_grade:2(系统默认去噪,同时去除定位精度低于500的轨迹点,相当于保留GPS定位点、大部分Wi-Fi定位点和精度较高的基站定位点)<br/><br/> | ||
+ | denoise_grade:3(系统默认去噪,同时去除定位精度低于100的轨迹点,相当于保留GPS定位点和大部分Wi-Fi定位点)<br/><br/> | ||
+ | denoise_grade:4(系统默认去噪,同时去除定位精度低于50的轨迹点,相当于保留GPS定位点和精度较高的Wi-Fi定位点)<br/><br/> | ||
+ | denoise_grade:5(系统默认去噪,同时去除定位精度低于20的轨迹点,相当于仅保留GPS定位点)<br/><br/> | ||
+ | |||
+ | 4. vacuate_grade(抽稀力度)<br/><br/> | ||
+ | 取值范围[0,5],数值越大抽稀度力度越大,代表轨迹会越稀疏。若取值0,则代表不抽稀。示例:<br/><br/> | ||
+ | vacuate_grade:0(不抽稀)<br/><br/> | ||
+ | vacuate_grade:2(抽稀力度为2)<br/><br/> | ||
+ | |- | ||
+ | |supplement_mode | ||
+ | |里程补偿设置 | ||
+ | |string(0-128) | ||
+ | |否 | ||
+ | |默认值:no_supplement<br/><br/> | ||
+ | 在里程计算时,两个轨迹点定位时间间隔5分钟以上,被认为是中断。中断轨迹提供以下5种里程估算方式。<br/> | ||
+ | |||
+ | no_supplement:不补充,中断两点间距离不记入里程<br/> | ||
+ | |||
+ | straight:使用直线距离补充<br/> | ||
+ | |||
+ | driving:使用最短驾车路线距离补充<br/> | ||
+ | |||
+ | riding:使用最短骑行路线距离补充<br/> | ||
+ | |||
+ | walking:使用最短步行路线距离补充<br/> | ||
+ | |- | ||
+ | | coord_type_output | ||
+ | | 返回的坐标类型 | ||
+ | | string | ||
+ | | 否 | ||
+ | | 默认值:bd09ll | ||
+ | 该字段用于控制返回结果中的坐标类型。可选值为: | ||
+ | |||
+ | gcj02:国测局加密坐标 | ||
+ | |||
+ | bd09ll:百度经纬度坐标 | ||
+ | |||
+ | 该参数仅对国内(包含港、澳、台)轨迹有效,海外区域轨迹均返回 wgs84坐标系 | ||
+ | <!--|- | ||
+ | | extensions | ||
+ | |返回结果控制 | ||
+ | | string | ||
+ | | 否 | ||
+ | | 可选,默认:extensions=base | ||
+ | |||
+ | 多个值用逗号分隔,目前支持以下值: | ||
+ | |||
+ | base:返回基础信息 | ||
+ | |||
+ | road_info:在base的基础上增加返回道路等级(road_grade)、道路限速(car_limit_speed)信息(注:目前road_info仅在开发者申请开通了道路等级和道路限速字段权限后才生效) | ||
+ | |||
+ | 示例:extensions=road_info,则返回base信息和road_grade、car_limit_speed--> | ||
+ | |- | ||
+ | | sn | ||
+ | |用户的权限签名 | ||
+ | | string | ||
+ | | 否 | ||
+ | |若用户所用ak的校验方式为sn校验时该参数必须。 [http://lbsyun.baidu.com/index.php?title=webapi/appendix sn校验说明] | ||
|} | |} | ||
+ | <div class="separate-title">返回参数</div> | ||
+ | {| | ||
+ | |- | ||
+ | ! width="100" colspan="2" | 参数名 | ||
+ | ! width="200" | 参数含义 | ||
+ | ! width="100" | 类型 | ||
+ | ! width="400" | 备注 | ||
+ | |- | ||
+ | | colspan="2" | status | ||
+ | | 状态码 | ||
+ | | int | ||
+ | | 详见[http://lbsyun.baidu.com/index.php?title=webapi/appendix 状态码定义] | ||
+ | |- | ||
+ | | colspan="2" | message | ||
+ | | 响应信息 | ||
+ | | string | ||
+ | | 对status的中文描述 | ||
+ | |- | ||
+ | | colspan="2" | total | ||
+ | | 忽略掉page_index,page_size后的轨迹点数量 | ||
+ | | | ||
+ | | 代表一共有多少条符合条件的track | ||
+ | |- | ||
+ | | colspan="2" | distance | ||
+ | | 此段轨迹的里程数,单位:米 | ||
+ | | double | ||
+ | | 符合条件的所有轨迹点的总里程。 | ||
+ | |- | ||
+ | | colspan="2" | toll_distance | ||
+ | | 此段轨迹的收费里程数,单位:米 | ||
+ | | double | ||
+ | | 收费道路包括高速等收费路段。 | ||
+ | |- | ||
+ | | colspan="2" | points | ||
+ | | 历史轨迹点列表 | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | | ||
+ | | longitude | ||
+ | | 经度 | ||
+ | | double | ||
+ | | | ||
+ | |- | ||
+ | | | ||
+ | | latitude | ||
+ | | 纬度 | ||
+ | | double | ||
+ | | | ||
+ | |- | ||
+ | | | ||
+ | | loc_time | ||
+ | | 定位时的设备时间 | ||
+ | | UNIX时间戳 | ||
+ | | 该时间为用户上传的时间 | ||
+ | |- | ||
+ | | | ||
+ | | direction | ||
+ | | 方向 | ||
+ | | int | ||
+ | | 范围为[0,359],0度为正北方向,顺时针 | ||
+ | |- | ||
+ | | | ||
+ | | height | ||
+ | | 高度 | ||
+ | | double | ||
+ | | 只在GPS定位结果时才返回,单位米 | ||
+ | |- | ||
+ | | | ||
+ | | speed | ||
+ | | 速度 | ||
+ | | double | ||
+ | | 单位:km/h | ||
+ | |- | ||
+ | | | ||
+ | | radius | ||
+ | | 定位精度 | ||
+ | | double | ||
+ | | 单位:m | ||
+ | |- | ||
+ | | | ||
+ | | coord_type | ||
+ | | 坐标类型 | ||
+ | | string | ||
+ | | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 | ||
+ | |} | ||
+ | <div class="separate-title">请求示例</div><div class="serve-explain-text">https://mapopen-website-wiki.bj.bcebos.com/trackmatch/trackrectify-demo.png<br/><br/><div class="separate-title">POST BODY中请求参数填写示例</div><pre class="prettyprint codestyle">ak:<您的ak> | ||
+ | point_list: [{"loc_time":1624295452,"latitude":36.2715924153,"longitude":120.401133898,"coord_type_input":"bd09ll"},{"loc_time":1624295615,"latitude":36.2710674153,"longitude":120.401122046,"coord_type_input":"bd09ll"},{"loc_time":1624295715,"latitude":36.2710674153,"longitude":120.401122046,"coord_type_input":"bd09ll"},{"loc_time":1624295815,"latitude":36.26970681,"longitude":120.406126,"coord_type_input":"bd09ll"},{"loc_time":1624295915,"latitude":36.2626899159,"longitude":120.406257629,"coord_type_input":"bd09ll"},{"loc_time":1624296015,"latitude":36.2554959254,"longitude":120.401709345,"coord_type_input":"bd09ll"},{"loc_time":1624296115,"latitude":36.2482072286,"longitude":120.398668032,"coord_type_input":"bd09ll"},{"loc_time":1624296215,"latitude":36.2453202208,"longitude":120.390573255,"coord_type_input":"bd09ll"},{"loc_time":1624296315,"latitude":36.2462943954,"longitude":120.378697631,"coord_type_input":"bd09ll"},{"loc_time":1624296415,"latitude":36.2464401658,"longitude":120.368128971,"coord_type_input":"bd09ll"},{"loc_time":1624296515,"latitude":36.2411743783,"longitude":120.360663512,"coord_type_input":"bd09ll"}] | ||
− | + | rectify_option: need_mapmatch:1|transport_mode:driving|denoise_grade:1|vacuate_grade:1 | |
+ | </pre> | ||
+ | </div><div class="separate-title">返回示例</div><pre class="prettyprint codestyle"> | ||
+ | { | ||
+ | "status":0, | ||
+ | "message":"成功", | ||
+ | "total":38, | ||
+ | "distance":7004.2268595795, | ||
+ | "toll_distance":0, | ||
+ | "low_speed_distance":0, | ||
+ | "points":[ | ||
+ | { | ||
+ | "loc_time":1624295452, | ||
+ | "latitude":36.271593819832, | ||
+ | "longitude":120.40114354244, | ||
+ | "speed":1.2875764132772, | ||
+ | "direction":178.38227415059 | ||
+ | }, | ||
+ | { | ||
+ | "loc_time":1624295615, | ||
+ | "latitude":36.270452489393, | ||
+ | "longitude":120.40113828855, | ||
+ | "speed":8.4496861276931, | ||
+ | "direction":93.59750062432 | ||
+ | }, | ||
+ | ... | ||
+ | { | ||
+ | "loc_time":1624296515, | ||
+ | "latitude":36.241216624104, | ||
+ | "longitude":120.36069744837, | ||
+ | "speed":31.788581427876, | ||
+ | "direction":130.91381579391 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | </pre> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | </div> | ||
− | + | <!--内容4--> | |
− | + | <div class="navRemark"><div class="handpointto">使用指南</div></div> | |
− | + | <div class="txtstyle2"><div class="bluetitle"><div class="services-title-text">使用方法</div></div><div class="useguide"><div class="useguide_bg"></div><div class="useguide_li"> | |
− | + | <span>1</span> [https://passport.baidu.com/v2/?reg&tt=1494238640555&gid=E85D052-3B8B-45D0-9412-D0B861D79A5D&tpl=pp&u=https://passport.baidu.com/ 申请百度账号] | |
+ | </div><div class="useguide_li"> | ||
+ | <span>2</span> [http://lbsyun.baidu.com/apiconsole/key 申请成为百度开发者] | ||
+ | </div><div class="useguide_li"> | ||
+ | <span>3</span> [http://lbsyun.baidu.com/apiconsole/key/create 获取服务密钥(AK)] | ||
+ | </div><div class="useguide_li" style="margin-right:0;"> | ||
+ | <span>4</span> [http://lbsyun.baidu.com/index.php?title=webapi/guide/trackrectify 发送请求,使用服务] | ||
− | |||
+ | </div></div><div class="bluetitle"><div class="services-title-text">编码说明</div></div> | ||
+ | API请求中需要用到中文或一些特殊字符的参数,如query、region等,为了避免提交到后台乱码,需要对这几个参数值进行编码处理,转换成UTF-8字符的二字符十六进制值,凡是不在下表中的字符都需要进行编码。 | ||
+ | |||
+ | {| border="1" cellspacing="1" cellpadding="1" style="width: 957px;" | ||
+ | |- | ||
+ | | style="text-align: center; width: 91px;" | '''字符集合''' | ||
+ | | style="width: 823px; text-align: center;" | '''字符''' | ||
+ | |- | ||
+ | | style="text-align: center; width: 91px;" | URL非保留字<br/> | ||
+ | | style="width: 823px;" | a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 - _ . ~<br/> | ||
+ | |- | ||
+ | | style="text-align: center; width: 91px;" | URL保留字<br/> | ||
+ | | style="width: 823px;" | ! * ' ( ) ; : @ & = + $ , / ? % # [ ]<br/> | ||
+ | |} | ||
+ | |||
+ | 如果中文参数中使用URL保留字字符的字面意思,例如:region关键字取值为"?北京",检索关键字包含一个问号,此问号也必须进行编码。 | ||
+ | |||
+ | 附注: | ||
+ | |||
+ | {{bluepoint}}javascript中一般采用encodeURIComponent函数对特殊字符进行编码。 | ||
+ | |||
+ | {{bluepoint}}Java中可以使用函数URLEncoder.encode对特殊字符进行编码。 | ||
+ | |||
+ | {{bluepoint}}C#中可以使用函数HttpUtility.UrlEncode对特殊字符进行编码。 | ||
+ | |||
+ | {{bluepoint}}php中可以使用函数urlencode对特殊字符进行编码。 | ||
+ | <div class="bluetitle"><div class="services-title-text">坐标系说明</div></div> | ||
+ | {{bluepoint}}WGS84:为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。<br/><br/>{{bluepoint}}GCJ02:是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。<br/><br/>{{bluepoint}}BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标<br/><br/>{{bluepoint}}轨迹纠偏服务输入输出坐标类型默认为百度坐标(bd09ll),同时可通过参数("coord_type","coord_type_output")控制输入输出坐标类型。输入坐标支持以上三种坐标系,输出坐标在国内支持-国测局坐标(GCJ02)和百度坐标(BD09),在海外支持WGS84<br/><br/><span style="color:#FF0000;">注意:不同类型坐标如需转换,请使用百度地图开放平台提供的</span>[http://lbsyun.baidu.com/index.php?title=webapi/guide/changeposition 标准坐标转换接口]<span style="color:#FF0000;">。请勿使用其他渠道提供的坐标转换方法,以免影响坐标转换精度。</span> | ||
+ | <div class="bluetitle"><div class="services-title-text">服务使用限制</div></div> | ||
+ | 服务相关配额及并发请求限制请访问[http://lbsyun.baidu.com/apiconsole/auth/privilege 开发者权益]页面查看。 | ||
</div> | </div> | ||
+ | |||
+ | |||
+ | |||
+ | <!--内容6--> | ||
+ | <div class="navRemark"><div class="handpointto">内容(更新日志)</div></div> | ||
+ | <div class="txtstyle2"><div class="updatedemo"><div class="uptitle"><div class="next timecut"></div><div class="prve timecut"></div><div class="updatetime"><div class="controlshow"><div class="timeversions intro"> | ||
+ | 2018年7月23日 | ||
+ | |||
+ | V1.0 | ||
+ | </div></div></div> | ||
+ | |||
+ | <div class="linellae"></div></div><div class="updatecenter"><div class="updatebox"><div class="bluetitle"><div class="services-title-text">产品发布</div></div><div class="serve-explain-text">发布轨迹纠偏接口v1.0,支持对一串连续的轨迹点进行纠偏、绑路、抽稀、里程计算、返回道路信息等处理,并返回纠偏后的轨迹点和里程</div></div></div></div></div></div> |
2021年8月25日 (三) 19:15的最后版本
通常各种定位方式都存在着一定的误差,GPS信号不好的时候(例如,楼宇密集处、高架桥下、隧道等),可能就会使用WIFI或基站定位,特别是当周边WIFI热点比较少的时候会使用基站定位,定位误差会有所加大,产生轨迹漂移的现象。
为了纠正轨迹漂移,提升轨迹和里程的准确性,轨迹纠偏API提供了高性能的轨迹纠偏和绑路服务,其特性如下:
1. 高性能:一次请求支持对2000个轨迹点(轨迹里程不超过500公里)进行批量纠偏处理
2. 可配置:开放多种纠偏因子供开发者自行调节
3. 适用性:针对驾车、骑行和步行不同出行模式执行对应的轨迹纠偏策略,并针对停留点漂移进行了单独识别与处理,故对于移动和停留期间的轨迹均有优异的纠偏效果
说明1:轨迹纠偏API与鹰眼中的纠偏能力和效果一致,用于满足只对轨迹纠偏有需求,而不需进行轨迹存储的用户。开发者可根据自己的场景灵活选择鹰眼和轨迹纠偏API。
纠偏并计算里程。
https://api.map.baidu.com/rectify/v1/track? //POST请求
参数名 | 参数含义 | 类型 | 是否必填 | 备注 |
---|---|---|---|---|
ak | 用户的AK,授权使用 | string | 是 | |
point_list | 轨迹点序列 | string(1-1M) | 是 | 最多不能超过2000个轨迹点,且轨迹里程不超过500公里(注:若轨迹里程超长,可能会出现响应时间过长或超时)。point_list格式为json, 其中每个point必须包含:latitude,longitude,coord_type_input,loc_time这4个字段,可选speed,direction,height,radius这4个字段,其他字段会被舍弃。 取值规则: latitude:纬度,支持小数点后6位 longitude:经度,支持小数点后6位 coord_type_input:轨迹点的坐标系,支持以下值:bd09ll(百度经纬度坐标)、gcj02(国测局加密坐标)、wgs84(GPS所采用的坐标系) loc_time:轨迹点的定位时间,使用UNIX时间戳(秒级) speed:轨迹点的速度,double类型,单位:公里/小时 direction:轨迹点的方向,int类型,单位:范围为[0,359],0度为正北方向,顺时针方向递增 height:轨迹点的高度,double类型,单位:米 radius:定位时返回的定位精度,double类型,单位:米 |
rectify_option | 纠偏设置 | string(0-128) | 否 | 支持以下配置项,多个项之间用”|”竖线相隔。默认值为:need_mapmatch:1|transport_mode:auto|denoise_grade:1|vacuate_grade:1 取值规则为: 1. need_mapmatch(绑路) 2. transport_mode(交通方式) 3. denoise_grade(去噪力度) 4. vacuate_grade(抽稀力度) |
supplement_mode | 里程补偿设置 | string(0-128) | 否 | 默认值:no_supplement 在里程计算时,两个轨迹点定位时间间隔5分钟以上,被认为是中断。中断轨迹提供以下5种里程估算方式。 no_supplement:不补充,中断两点间距离不记入里程 straight:使用直线距离补充 driving:使用最短驾车路线距离补充 riding:使用最短骑行路线距离补充 walking:使用最短步行路线距离补充 |
coord_type_output | 返回的坐标类型 | string | 否 | 默认值:bd09ll
该字段用于控制返回结果中的坐标类型。可选值为: gcj02:国测局加密坐标 bd09ll:百度经纬度坐标 该参数仅对国内(包含港、澳、台)轨迹有效,海外区域轨迹均返回 wgs84坐标系 |
sn | 用户的权限签名 | string | 否 | 若用户所用ak的校验方式为sn校验时该参数必须。 sn校验说明 |
参数名 | 参数含义 | 类型 | 备注 | |
---|---|---|---|---|
status | 状态码 | int | 详见状态码定义 | |
message | 响应信息 | string | 对status的中文描述 | |
total | 忽略掉page_index,page_size后的轨迹点数量 | 代表一共有多少条符合条件的track | ||
distance | 此段轨迹的里程数,单位:米 | double | 符合条件的所有轨迹点的总里程。 | |
toll_distance | 此段轨迹的收费里程数,单位:米 | double | 收费道路包括高速等收费路段。 | |
points | 历史轨迹点列表 | |||
longitude | 经度 | double | ||
latitude | 纬度 | double | ||
loc_time | 定位时的设备时间 | UNIX时间戳 | 该时间为用户上传的时间 | |
direction | 方向 | int | 范围为[0,359],0度为正北方向,顺时针 | |
height | 高度 | double | 只在GPS定位结果时才返回,单位米 | |
speed | 速度 | double | 单位:km/h | |
radius | 定位精度 | double | 单位:m | |
coord_type | 坐标类型 | string | 该字段仅在海外区域时返回,返回值为:wgs84。当坐标位于国内(含港、澳、台)时,返回坐标类型与请求参数 coord_type_output 所设一致,因此不再返回该字段 |
ak:<您的ak> point_list: [{"loc_time":1624295452,"latitude":36.2715924153,"longitude":120.401133898,"coord_type_input":"bd09ll"},{"loc_time":1624295615,"latitude":36.2710674153,"longitude":120.401122046,"coord_type_input":"bd09ll"},{"loc_time":1624295715,"latitude":36.2710674153,"longitude":120.401122046,"coord_type_input":"bd09ll"},{"loc_time":1624295815,"latitude":36.26970681,"longitude":120.406126,"coord_type_input":"bd09ll"},{"loc_time":1624295915,"latitude":36.2626899159,"longitude":120.406257629,"coord_type_input":"bd09ll"},{"loc_time":1624296015,"latitude":36.2554959254,"longitude":120.401709345,"coord_type_input":"bd09ll"},{"loc_time":1624296115,"latitude":36.2482072286,"longitude":120.398668032,"coord_type_input":"bd09ll"},{"loc_time":1624296215,"latitude":36.2453202208,"longitude":120.390573255,"coord_type_input":"bd09ll"},{"loc_time":1624296315,"latitude":36.2462943954,"longitude":120.378697631,"coord_type_input":"bd09ll"},{"loc_time":1624296415,"latitude":36.2464401658,"longitude":120.368128971,"coord_type_input":"bd09ll"},{"loc_time":1624296515,"latitude":36.2411743783,"longitude":120.360663512,"coord_type_input":"bd09ll"}] rectify_option: need_mapmatch:1|transport_mode:driving|denoise_grade:1|vacuate_grade:1
{ "status":0, "message":"成功", "total":38, "distance":7004.2268595795, "toll_distance":0, "low_speed_distance":0, "points":[ { "loc_time":1624295452, "latitude":36.271593819832, "longitude":120.40114354244, "speed":1.2875764132772, "direction":178.38227415059 }, { "loc_time":1624295615, "latitude":36.270452489393, "longitude":120.40113828855, "speed":8.4496861276931, "direction":93.59750062432 }, ... { "loc_time":1624296515, "latitude":36.241216624104, "longitude":120.36069744837, "speed":31.788581427876, "direction":130.91381579391 } ] }
API请求中需要用到中文或一些特殊字符的参数,如query、region等,为了避免提交到后台乱码,需要对这几个参数值进行编码处理,转换成UTF-8字符的二字符十六进制值,凡是不在下表中的字符都需要进行编码。
字符集合 | 字符 |
URL非保留字 |
a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 - _ . ~ |
URL保留字 |
! * ' ( ) ; : @ & = + $ , / ? % # [ ] |
如果中文参数中使用URL保留字字符的字面意思,例如:region关键字取值为"?北京",检索关键字包含一个问号,此问号也必须进行编码。
附注:
javascript中一般采用encodeURIComponent函数对特殊字符进行编码。
Java中可以使用函数URLEncoder.encode对特殊字符进行编码。
C#中可以使用函数HttpUtility.UrlEncode对特殊字符进行编码。
php中可以使用函数urlencode对特殊字符进行编码。
WGS84:为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。
GCJ02:是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。
BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标
轨迹纠偏服务输入输出坐标类型默认为百度坐标(bd09ll),同时可通过参数("coord_type","coord_type_output")控制输入输出坐标类型。输入坐标支持以上三种坐标系,输出坐标在国内支持-国测局坐标(GCJ02)和百度坐标(BD09),在海外支持WGS84
注意:不同类型坐标如需转换,请使用百度地图开放平台提供的标准坐标转换接口。请勿使用其他渠道提供的坐标转换方法,以免影响坐标转换精度。
服务相关配额及并发请求限制请访问开发者权益页面查看。
2018年7月23日
V1.0