美文网首页农机轨迹分析
基于hive的农机轨迹分析

基于hive的农机轨迹分析

作者: 至极L | 来源:发表于2017-07-13 09:18 被阅读32次

    注:本文所用时间为14量车的总时间单位为秒。

    一、对数据的简单分析

    1.总数据量的统计

    select count(*) as number from trajectory; #总数据条数为2千万条 
    
    image.png

    2.查询有多少量车

    select count(distinct vme_id) from trajectory; #共有14量车```
    
    
    ![image.png](https://img.haomeiwen.com/i2538708/de571b9fd90c9275.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    #二、农机运营分析
    1.查询有多少轨迹点速度等于0(即休息时间)
    

    select count(*) from trajectory where speed=0;```


    image.png
    休息时间占比为4540327/20249036=0.22
    

    2.查询平均作业深度(去除非作业数据)

    select avg(work_deep) from trajectory where work_deep>50;#作业平均深度为40
    
    image.png

    3.查询作业时间

    select count(*)  from trajectory where work_deep>100  #输出7712956;
    select count(*) from trajectory where work_deep>200   #输出7681255;
    select count(*)  from trajectory where work_deep>300   #输出7490286;
    select count(*)  from trajectory where work_deep>350   #输出6905956;
    select count(*) from trajectory where work_deep>400    #输出3478811;
    
    image.png
    以深度300以上为作业:7490286/20249036=0.37
    

    4.查询速度

    select max(speed) from trajectory; #最大数据27
    select avg(speed) from trajectory; #平均速度3.2
    select min(speed) from trajectory; #最小速度0
    select speed , count(*) from trajectory  group by speed;
    
    image.png
    横坐标为速度, 纵坐标为轨迹点数目,速度为车辆的瞬时速度。
    

    5.查询作业深度

    select work_deep, count(*) from trajectory group by work_deep;
    
    image.png

    6.其他


    image.png
    1表示速度为0(蓝色)和速度非零的作业时间
    2表示作业深度小于50(蓝色)和作业深度大于50的作业时间
    从途中可以看出非作业中很大一部分时间中农机处于停息状态约占22%.
    

    三、基于时间的农机轨迹分析

    1.作业月份分析

    select month(gps_time, count(*)) from trajectory group by month(gps_time);```
    ![image.png](https://img.haomeiwen.com/i2538708/8714d43219966fba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    2.不同农机运营时间分析
    

    select vme_id ,count(*) from trajectory group by vme_id ; ```


    image.png

    3.不同农机作业时间分析

    select vme_id ,count(*) from trajectory where work_deep>50 group by vme_id  ; ```
    
    ![image.png](https://img.haomeiwen.com/i2538708/eecd3c662862ece3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    4.不同时间段作业分析
    
    ![image.png](https://img.haomeiwen.com/i2538708/7dea75f31f1e7626.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

    相关文章

      网友评论

        本文标题:基于hive的农机轨迹分析

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