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 @@ -3528,7 +3528,7 @@ function addPosition(position) {
35283528 } ;
35293529
35303530 // if car doesn't report heading, we calculate it from the last position
3531- if ( vehicle . num_positions > 1 && vehicle . vehicle_type == 'car' && 'gps_heading' in position && position . gps_heading === "" ) {
3531+ if ( vehicle . num_positions > 1 && vehicle . vehicle_type == 'car' ) {
35323532
35333533 // Source
35343534 var startLat = toRadians ( vehicle . curr_position . gps_lat ) ;
@@ -4835,7 +4835,22 @@ function updatePredictions(r) {
48354835 if ( vehicle . prediction && vehicle . prediction . time == r [ i ] . time ) continue ;
48364836 vehicle . prediction = r [ i ] ;
48374837 vehicle . prediction . data = $ . parseJSON ( r [ i ] . data ) ;
4838- redrawPrediction ( vcallsign ) ;
4838+
4839+ // Figure out local ground level.
4840+ if ( vehicle . prediction . data . length >= 2 ) {
4841+ vehicle . local_ground_asl = vehicle . prediction . data [ vehicle . prediction . data . length - 1 ] [ 'alt' ] ;
4842+ } else {
4843+ vehicle . local_ground_asl = 0 ;
4844+ }
4845+
4846+ // Only draw prediction if the last known position of the payload was > 100m above local ground level.
4847+ if ( ( vehicle . curr_position [ 'gps_alt' ] - vehicle . local_ground_asl ) > 100 ) {
4848+ redrawPrediction ( vcallsign ) ;
4849+ } else {
4850+ continue ;
4851+ }
4852+
4853+
48394854 }
48404855 }
48414856}
You can’t perform that action at this time.
0 commit comments