轨迹纠偏
根据车辆的GPS数据(最少 10 个轨迹点,距离大于 50 米),返回这些轨迹点所在的道路基本信息和当前路况信息,返回周边的地标性POI点。示例代码如下:
RouteMatch routeMatch=new RouteMatch(); //设置gps数据,这些值只作为用法的参考,具体还是要通过设备获取 RouteMatch.GPSInfo[] gpsInfos=new RouteMatch.GPSInfo[]{ new RouteMatch.GPSInfo(116.324225,39.893390,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893391,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893392,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893393,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893394,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893395,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893396,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893397,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893398,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893399,10.0,0,1,2019526313858L), }; //设置参数 routeMatch.setQuery(RouteMatch.Query.newQuery("12324",RouteMatchSourceType.PHONE,gpsInfos)); //设置监听 routeMatch.setListener(new RouteMatch.Listener() { @Override public void onSuccess(RouteMatchResult result) { //请求成功 } @Override public void onFail(APIStatus status) { //请求失败 } }); //发起轨迹纠偏 routeMatch.match();
RouteMatch.Query说明:
1. 构造方法 RouteMatch.Query.newQuery(String guid, String source, GPSInfo[] gpsinfos);
2. 参数 guid: 设备的id;
3. 参数 source: gps数据来源类型,类型取值RouteMatchSourceType类常量,如下表:
数据来源类型 | 含义 |
---|---|
RouteMatchSourceType.CARNAVI |
车载导航仪 |
RouteMatchSourceType.PHONE |
手机 |
RouteMatchSourceType.SWEAR |
智能穿戴设备 |
4. 参数 gpsinfos: gps数据集合。
注:结果返回接口为异步线程接口。