Skip to content

Commit 602bdba

Browse files
committed
lat lon 180 fix
1 parent f50ddaf commit 602bdba

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

js/tracker.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,9 +1486,11 @@ function createHysplit(callsign, adjustment) {
14861486
endTime.setHours(endTime.getHours() + 84);
14871487
endTime = endTime.toISOString();
14881488

1489+
var lon = ((360 + (vehicle.curr_position.gps_lon % 360)) % 360)
1490+
14891491
var url = "https://predict.cusf.co.uk/api/v1/?profile=float_profile"
14901492
+ "&launch_latitude=" + vehicle.curr_position.gps_lat
1491-
+ "&launch_longitude=" + vehicle.curr_position.gps_lon
1493+
+ "&launch_longitude=" + lon
14921494
+ "&launch_altitude=" + (altitude-1)
14931495
+ "&launch_datetime=" + vehicle.curr_position.gps_time
14941496
+ "&ascent_rate=0.1"
@@ -1503,7 +1505,17 @@ function createHysplit(callsign, adjustment) {
15031505
var start = new L.LatLng(vehicle.curr_position.gps_lat, vehicle.curr_position.gps_lon);
15041506
var path = [start];
15051507
for (let point in data.prediction[1].trajectory) {
1506-
var position = new L.LatLng(data.prediction[1].trajectory[point].latitude, data.prediction[1].trajectory[point].longitude)
1508+
if (data.prediction[1].trajectory[point].latitude > 180.0) {
1509+
var lat = data.prediction[1].trajectory[point].latitude - 360.0;
1510+
} else {
1511+
var lat = data.prediction[1].trajectory[point].latitude;
1512+
}
1513+
if (data.prediction[1].trajectory[point].longitude > 180.0) {
1514+
var lon = data.prediction[1].trajectory[point].longitude - 360.0;
1515+
} else {
1516+
var lon = data.prediction[1].trajectory[point].longitude;
1517+
}
1518+
var position = new L.LatLng(lat, lon);
15071519
path.push(position);
15081520
}
15091521
vehicle.prediction_hysplit[adjustment] = new L.Wrapped.Polyline(path);

0 commit comments

Comments
 (0)