Skip to content

Commit e2355d0

Browse files
Mark Jessopbismurphy
authored andcommitted
Make showing predictions conditional on sonde being more than 100m above local ground level
1 parent 58dbd7d commit e2355d0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

js/tracker.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)