轨迹纠偏函数

作者: AllanHao | 来源:发表于2018-09-21 14:24 被阅读31次

轨迹纠偏函数

--平滑轨迹
CREATE OR REPLACE FUNCTION GetSmoothGpsPt () RETURNS void AS $$
DECLARE vSmoothSpan integer;
declare rec  record;
declare tempRec record;
declare Wi float;
declare Wx float;
declare Wy float;
declare Wa float;
declare sumWX float;
declare sumWY float;
declare sumWA float;
declare sumW float;
declare Latitude float;
declare Longitude float;
declare TimeGap integer;
declare angle float;
BEGIN
vSmoothSpan := 30 ; 
for rec in select *,ST_Azimuth(LAG (the_geom) OVER ( ORDER BY update_time),LEAD (the_geom) OVER (ORDER BY update_time))/(2 * pi()) * 360 angle from nts_io_postgis_2d order by update_time loop
sumWX:= 0; sumWY:= 0; sumWA:= 0;sumW:=0;
--高斯滤波,已Gps点位前后三十秒的数据进行加权平滑
for tempRec in select  *,ST_Azimuth(LAG (the_geom) OVER (ORDER BY update_time),LEAD (the_geom) OVER (ORDER BY update_time))/(2 * pi()) * 360 angle from nts_io_postgis_2d t where t.update_time::time BETWEEN rec.update_time::time- interval '10 S' and  rec.update_time::time+ '10 S' loop
--raise notice '正在处理Longitude:%',tempRec.angle;
TimeGap:=extract(epoch FROM (rec.update_time :: TIME - tempRec.update_time :: TIME ));
Wi:=exp((-1) * TimeGap * TimeGap / (2 * vSmoothSpan * vSmoothSpan));
Wx:= Wi * st_x(tempRec.the_geom);
Wy:= Wi * st_y(tempRec.the_geom);
Wa:=Wi*coalesce(tempRec.angle,0);
sumWX = sumWX+Wx;
sumWY = sumWY+Wy;
sumWA=sumWA+Wa;

sumW=sumW+ Wi;
end loop;
Longitude:= sumWX / sumW;
Latitude:= sumWY / sumW;
angle:=sumWA/sumW;

--raise notice '正在处理angle:%',sumWA;
--raise notice '正在处理Longitude:%,Latitude:%,angle:%',Longitude,Latitude,tempRec.angle;
--raise notice '正在处理geom:%',st_astext(ST_GeomFromText('POINT('||Longitude||' '||Latitude||')',4326));
--平滑后的数据入库
INSERT INTO public.gps_data_smooth ("datetime","geom","angle") VALUES ( rec.update_time,ST_GeomFromText('POINT('||Longitude||' '||Latitude||')',4326),angle);
end loop; 
END ; 
$$ LANGUAGE plpgsql; 

相关文章

  • 轨迹纠偏函数

    轨迹纠偏函数

  • Dart GPS轨迹纠偏算法

    功能描述 因项目需求,需要时刻跟踪用户当前位置。定位成功,手机静止不动的情况下,定位也会跳来跳去,总在漂移。 附上...

  • 运动轨迹纠偏解决方案

    当前随着人们对于健康的关注度越来越高,随之而来的是各种运动健康类app不断的出现在市场上,而跑步是成本最小,最易实...

  • iOS源码博文集锦3

    iOS精选源码 高仿淘宝首页 登录动画 iOS高德二次封装,有定位,轨迹,语音实时导航,GPS纠偏..... 逗视...

  • 地图轨迹纠偏的使用和路径平滑移动

    效果图: 废话不多说,直接上代码 到这里轨迹纠偏划线就好了.接下来开始添加平滑移动动画

  • 圆形轨迹函数

    # 圆形轨迹 function yuan(obj,x,y,s){ var num = 0; setInterval...

  • 人生轨迹是一条正弦函数

    人生轨迹是一条正弦函数 人生的轨迹是一条正弦函数 为什么有这样的感慨呢? 这句话有两部分的内容,“人生轨迹”,“正...

  • RoutePath-(高德地图)根据定位点绘制路线+轨迹纠偏

    轨迹纠偏的作用就是去掉绘制路线时候两个定位点之间产生的毛刺和尖角,使路线看起来更加的圆滑,正常 GitHub代码下...

  • 纠偏

    侄女从小学到初中都是班长而且是好班长,深得每位班主任的信赖和赞扬。但是2018年参加中考后,没有完成家人的“期望”...

  • 纠偏

    二月的第一天,怎么度过的? 熬到凌晨后,近三分之一的时间用在睡觉上 看了一个多小时电子书,读完21年第一本书,简写...

网友评论

    本文标题:轨迹纠偏函数

    本文链接:https://www.haomeiwen.com/subject/vzianftx.html