File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -3542,7 +3542,7 @@ function addPosition(position) {
35423542 } ;
35433543
35443544 // if car doesn't report heading, we calculate it from the last position
3545- if ( vehicle . num_positions > 1 && vehicle . vehicle_type == 'car' && 'gps_heading' in position && position . gps_heading === "" ) {
3545+ if ( vehicle . num_positions > 1 && vehicle . vehicle_type == 'car' ) {
35463546
35473547 // Source
35483548 var startLat = toRadians ( vehicle . curr_position . gps_lat ) ;
@@ -4849,7 +4849,22 @@ function updatePredictions(r) {
48494849 if ( vehicle . prediction && vehicle . prediction . time == r [ i ] . time ) continue ;
48504850 vehicle . prediction = r [ i ] ;
48514851 vehicle . prediction . data = $ . parseJSON ( r [ i ] . data ) ;
4852- redrawPrediction ( vcallsign ) ;
4852+
4853+ // Figure out local ground level.
4854+ if ( vehicle . prediction . data . length >= 2 ) {
4855+ vehicle . local_ground_asl = vehicle . prediction . data [ vehicle . prediction . data . length - 1 ] [ 'alt' ] ;
4856+ } else {
4857+ vehicle . local_ground_asl = 0 ;
4858+ }
4859+
4860+ // Only draw prediction if the last known position of the payload was > 100m above local ground level.
4861+ if ( ( vehicle . curr_position [ 'gps_alt' ] - vehicle . local_ground_asl ) > 100 ) {
4862+ redrawPrediction ( vcallsign ) ;
4863+ } else {
4864+ continue ;
4865+ }
4866+
4867+
48534868 }
48544869 }
48554870}
You can’t perform that action at this time.
0 commit comments