基于3D地图SDK,对真实轨迹进行处理,实现去噪、平滑和抽稀。
原始轨迹和处理后轨迹
- (void)initSmoothedTrace {
MASmoothPathTool *tool = [[MASmoothPathTool alloc] init];
tool.intensity = 3;
tool.threshHold = 0.3;
tool.noiseThreshhold = 10;
self.smoothedTracePoints = [tool pathOptimize:self.origTracePoints];
...
}
func initSmoothedTrace() {
let tool = MASmoothPathTool()
tool.intensity = 3
tool.threshHold = 0.3
tool.noiseThreshhold = 10
self.smoothedTracePoints = tool.pathOptimize(self.origTracePoints)
...
}
基于3D地图SDK,对真实轨迹进行处理,实现去噪、平滑和抽稀。
原始轨迹
处理后轨迹
// 获取轨迹坐标点
List<LatLng> mOriginList = new ArrayList<LatLng>();
PathSmoothTool mpathSmoothTool = new PathSmoothTool();
//设置平滑处理的等级
mpathSmoothTool.setIntensity(4);
List<LatLng> pathoptimizeList = mpathSmoothTool.pathOptimize(originlist);
//绘制轨迹,移动地图显示
if (mOriginList != null && mOriginList.size()>0) {
mOriginPolyline = amap.addPolyline(new PolylineOptions().addAll(mOriginList).color(Color.GREEN));
amap.moveCamera(CameraUpdateFactory.newLatLngBounds(getBounds(mOriginList), 200));
}