Skip to content

Commit d3b2f00

Browse files
Mark JessopMark Jessop
authored andcommitted
Make showing predictions conditional on sonde being more than 100m above local ground level
1 parent c16f0cd commit d3b2f00

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
@@ -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
}

0 commit comments

Comments
 (0)