Ither
Members-
Posts
54 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
phpVMS Resources
Downloads
Everything posted by Ither
-
I took the concept and did it -- yes. You'll want the entire track flight function copied over and then you need to call it when clicking on the pilot (so will need to make code for the onClick that fires off trackflight with their PID.
-
Just some technical heads up -- know there were threads at one point trying to figure out "why" a cron job on maintenance.php failed. I was looking at the original PHPVMS build against Clark's 5.5 build and I noticed that MainController::Run('Maintenance', 'resetpirepcount'); MainController::Run('Maintenance', 'resethours'); which translates to the respected Maintenance module function has this added CodonModule::checkPermission(MAINTENANCE); This is not in the original PHPVMS builds. The error is being caused because no matter what you do in a cronjob you are not an authenticated user. When the checkPermission function is fired it's coming back Unauthorized because you are not actually logged in (this is why the script runs perfectly fine from the admin page when you are logged in.) I've pretty much given up on figuring out how to make myself appear authenticated and decided to change the code to make it work (reason I did this is that I have Discord hooks sending messages when my maintenance starts and finishes, the error "unauthorized user" would break that. What did I do to get around that cron job error? The cronjob runs by access to the physical file on your server. There's no possible threat in that as the processor has access to the physical file. If your cronjobs are done properly you are fine. Open up the file admin/maintenance.php Add the following line at very top just beneath; <?php so that this file will not run from web browser; it will only run by a cron job. if (php_sapi_name() !='cli') exit; Open up the file admin/modules/Maintenance/Maintenance.php Locate the following functions: public static function resetpirepcount() public function resethours() Comment out the line that matches below with // //CodonModule::checkPermission(MAINTENANCE); You should now be able to run your cron job without it giving an error.
-
FIXED After setting up the sandbox it finally dawned on me. This here: } elseif ($entry > $exit) { # Go backwards through the list for ($l = $exit; $l >= $entry; $l--) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$l]; } Needs to change to: } elseif ($entry > $exit) { # Go backwards through the list for ($l = $entry; $l >= $exit; $l--) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$l]; } Now I have it working forwards and backwards now.
-
Correct. The function runs fine in all statements except when it needs to count waypoints backwards. I built a sandbox that lets me push that navdata function without needing live flights. Here are 2 images (they are large but should help understand.) It has preset validation (what I put into parser), Raw Results that the function dumped out, and then Airway Results (this is from the $airways variable when the function pulls all waypoints for the airway it detected in route string.) Preface: This image is a flight that has an Airway (J153) where the entry waypoint sequence is higher number then it's exit waypoint. This type of route does not parse and therefore all I get is the entry/exit waypoint--nothing in the middle. Link: https://imgur.com/a/zfAxXUx Preface: This image is a flight that has an Airway (N864) where the entry waypoint sequence is the lowest number and the exit is the highest number. This type of route always works and never has issue. Link: https://imgur.com/a/EIimLYm I'm at my ends of figuring it out -- I cannot find the problem in why it will not go backwards. If you want to tinker with it let me know -- I can give you access to my dev VM that has prod copy of site -- you can do whatever you want in it without impacting my live site. I really want to get this fixed because it is one last thing on my map that is not working right.
-
It's always -- if the entry to the airway is higher sequence number than the exit, thus it has to go backwards, it never pulls/adds the waypoints. If the entry is lower than exit sequence number it works fine. I've done some more debugging. You can dig through full function above to piece in -- here's what I can tell. if ($entry < $exit) { # Go forwards through the list adding each one for ($l = $entry; $l <= $exit; $l++) { $allpoints[$airways[$name][$l]->name] = $airways[$name][$l]; } } elseif ($entry > $exit) { # Go backwards through the list for ($l = $exit; $l >= $entry; $l--) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$l]; } } elseif ($entry == $exit) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$entry]; } # Now add the exit point, and increment the main counter by one if ($exit > -1) { $allpoints[$exit_name] = $airways[$name][$exit]; } continue; } } return $allpoints; The return $allpoints above gives me the entry (GEG) and exit (REO) {GEG: {…}, REO: {…}} GEG: {id: "17370", name: "GEG", title: "", airway: "J153", airway_type: "H", …} REO: {id: "17365", name: "REO", title: "", airway: "J153", airway_type: "H", …} __proto__: Object Now when I return $airways instead I do get entire J153 airway including waypoints that are missing -- they are in order: BLUNT - CHASS - BEAMO - BKE {J153: Array(8)} J153: Array(8) 0: {id: "17365", name: "REO", title: "", airway: "J153", airway_type: "H", …} 1: {id: "17366", name: "BKE", title: "", airway: "J153", airway_type: "H", …} 2: {id: "17367", name: "BEAMO", title: "", airway: "J153", airway_type: "H", …} 3: {id: "17368", name: "CHASS", title: "", airway: "J153", airway_type: "H", …} 4: {id: "17369", name: "BLUNT", title: "", airway: "J153", airway_type: "H", …} 5: {id: "17370", name: "GEG", title: "", airway: "J153", airway_type: "H", …} 6: {id: "17371", name: "ZB", title: "", airway: "J153", airway_type: "B", …} 7: {id: "17372", name: "DI", title: "", airway: "J153", airway_type: "B", …} length: 8 __proto__: Array(0) __proto__: Object I've dug into this more -- it's all around this: elseif ($entry > $exit) { # Go backwards through the list for ($l = $exit; $l >= $entry; $l--) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$l]; } This will not go backwards no matter what I try. I pulled the $airways array before this if statement and it all exists. {J153: Array(8)} J153: Array(8) 0: {id: "17365", name: "REO", title: "", airway: "J153", airway_type: "H", …} 1: {id: "17366", name: "BKE", title: "", airway: "J153", airway_type: "H", …} 2: {id: "17367", name: "BEAMO", title: "", airway: "J153", airway_type: "H", …} 3: {id: "17368", name: "CHASS", title: "", airway: "J153", airway_type: "H", …} 4: {id: "17369", name: "BLUNT", title: "", airway: "J153", airway_type: "H", …} 5: {id: "17370", name: "GEG", title: "", airway: "J153", airway_type: "H", …} 6: {id: "17371", name: "ZB", title: "", airway: "J153", airway_type: "B", …} 7: {id: "17372", name: "DI", title: "", airway: "J153", airway_type: "B", …} length: 8 __proto__: Array(0) __proto__: Object
-
So doing this above shows the waypoints that are missing, but they're in the wrong order (scrambled) but it at least found them. I did dump the $allpoints before everything else and it doesn't include missing waypoints. Here is route of flight I'm doing. DCT GEG J153 REO DCT MYBAD MYBAD2 $allpoints before any processing. {GEG: {…}, REO: {…}, MYBAD: "MYBAD", MYBAD2: "MYBAD2"} GEG: {id: "17370", name: "GEG", title: "", airway: "J153", airway_type: "H", …} MYBAD: "MYBAD" MYBAD2: "MYBAD2" REO: {id: "17365", name: "REO", title: "", airway: "J153", airway_type: "H", …} __proto__: Object What it's currently pulling. {GEG: {…}, REO: {…}, MYBAD: {…}} GEG: {id: "17017", name: "GEG", title: "GEG", airway: "J136", airway_type: "H", …} MYBAD: {id: "36434", name: "MYBAD", title: "MYBAD", airway: "Q132", airway_type: "H", …} REO: {id: "17365", name: "REO", title: "", airway: "J153", airway_type: "H", …} __proto__: Object What it's missing BLUNT - J153 - SEQUENCE 5 CHASS - J153 - SEQUENCE 4 BEAMO - J153 - SEQUENCE 3 BKE - J153 - SEQUENCE 2 REO - J153 - SEQUENCE 1
-
Long time no talk all. Hope everyone is well! I've been fighting the navdata point display on the maps and have finally gotten it to point where I am happy, however I discovered an issue I can't quite figure out. When you run the parseRoute to generate the waypoints on the live map; it goes through airways and finds the entry/exit and everything in between. This works fine when the entry to exit is position (going forward) but when it's backwards it doesn't pull anything. I have this particular airway where I'm entering at sequence 36 - KULIS and exiting at sequence 20 - SIDAK. It will not pull the values for sequence 35 to 21. Here is a JSON dump of the data after parsing; route_details: ANSOK: {id: "70025", name: "ANSOK", title: "", airway: "UZ42", airway_type: "H", …} ASEGI: {id: "70035", name: "ASEGI", title: "", airway: "UZ42", airway_type: "H", …} ASODA: {id: "70020", name: "ASODA", title: "", airway: "UZ42", airway_type: "H", …} BCO: {id: "70037", name: "BCO", title: "", airway: "UZ42", airway_type: "H", …} CLIZA: {id: "70033", name: "CLIZA", title: "", airway: "UZ42", airway_type: "H", …} CPN: {id: "70030", name: "CPN", title: "", airway: "UZ42", airway_type: "H", …} DANLI: {id: "70036", name: "DANLI", title: "", airway: "UZ42", airway_type: "H", …} DUBDU: {id: "70031", name: "DUBDU", title: "", airway: "UZ42", airway_type: "H", …} EKIDI: {id: "70040", name: "EKIDI", title: "", airway: "UZ42", airway_type: "H", …} ENROD: {id: "70016", name: "ENROD", title: "", airway: "UZ42", airway_type: "H", …} ENRUB: {id: "70015", name: "ENRUB", title: "", airway: "UZ42", airway_type: "H", …} ESORU: {id: "70042", name: "ESORU", title: "", airway: "UZ42", airway_type: "H", …} EVMIM: {id: "70027", name: "EVMIM", title: "", airway: "UZ42", airway_type: "H", …} GEKEM: {id: "70019", name: "GEKEM", title: "", airway: "UZ42", airway_type: "H", …} GENKO: {id: "70039", name: "GENKO", title: "", airway: "UZ42", airway_type: "H", …} GRD: {id: "70014", name: "GRD", title: "", airway: "UZ42", airway_type: "H", …} ILSAN: {id: "70029", name: "ILSAN", title: "", airway: "UZ42", airway_type: "H", …} KULIS: {id: "57176", name: "KULIS", title: "KULIS", airway: "UM415", airway_type: "H", …} LOKAM: {id: "70032", name: "LOKAM", title: "", airway: "UZ42", airway_type: "H", …} MUPAG: {id: "70034", name: "MUPAG", title: "", airway: "UZ42", airway_type: "H", …} NEKOP: {id: "70038", name: "NEKOP", title: "", airway: "UZ42", airway_type: "H", …} NEVKU: {id: "70022", name: "NEVKU", title: "", airway: "UZ42", airway_type: "H", …} OBLUG: {id: "70026", name: "OBLUG", title: "", airway: "UZ42", airway_type: "H", …} OPLEM: {id: "70021", name: "OPLEM", title: "", airway: "UZ42", airway_type: "H", …} PUMRO: {id: "70018", name: "PUMRO", title: "", airway: "UZ42", airway_type: "H", …} SIDAK: {id: "69160", name: "SIDAK", title: "", airway: "UZ22", airway_type: "H", …} UGOVU: {id: "70028", name: "UGOVU", title: "", airway: "UZ42", airway_type: "H", …} UGPOP: {id: "70041", name: "UGPOP", title: "", airway: "UZ42", airway_type: "H", …} UKLIM: {id: "70023", name: "UKLIM", title: "", airway: "UZ42", airway_type: "H", …} UMSIL: {id: "69161", name: "UMSIL", title: "", airway: "UZ22", airway_type: "H", …} UTLUP: {id: "70024", name: "UTLUP", title: "", airway: "UZ42", airway_type: "H", …} VAGOR: {id: "69162", name: "VAGOR", title: "", airway: "UZ22", airway_type: "H", …} VALEV: {id: "70017", name: "VALEV", title: "", airway: "UZ42", airway_type: "H", …} Here is my entry waypoint KULIS: airway: "UM415" airway_type: "H" freq: "" id: "57176" lat: "-13.477331" lng: "-74.951080" loc: "SAM" name: "KULIS" seq: "36" title: "KULIS" type: "5" You can see seq = 36, my exit waypoint for this is seq = 20. SIDAK AIRAWAY: UM415 SEQ: 20 Here's the function in NavData.class.php public static function parseRoute($schedule) { $fromlat = $schedule->deplat; $fromlng = $schedule->deplng; $route_string = $schedule->route; if ($route_string == '') { return array(); } // Remove any SID/STAR text //$route_string = str_replace('SID', '', $route_string); //$route_string = str_replace('STAR', '', $route_string); $route_string = str_replace('DCT', '', $route_string); $navpoints = array(); $all_points = explode(' ', $route_string); foreach ($all_points as $key => $value) { if (empty($value) === true) { continue; } $navpoints[] = strtoupper(trim($value)); } $allpoints = array(); $total = count($navpoints); $airways = self::getAirways($navpoints); for ($i = 0; $i < $total; $i++) { $name = self::cleanName($navpoints[$i]); /* the current point is an airway, so go through the airway list and add each corresponding point between the entry and exit to the list. */ if (isset($airways[$name])) { $entry_name = self::cleanName($navpoints[$i - 1]); $exit_name = self::cleanName($navpoints[$i + 1]); $entry = self::getPointIndex($entry_name, $airways[$name]); $exit = self::getPointIndex($exit_name, $airways[$name]); if ($entry == -1) { $entry = $exit; } else { /* Add information abotu the entry point in first, if it's valid and exists */ $allpoints[$entry_name] = $airways[$name][$entry]; } if ($exit == -1) { continue; } if ($entry < $exit) { # Go forwards through the list adding each one for ($l = $entry; $l <= $exit; $l++) { $allpoints[$airways[$name][$l]->name] = $airways[$name][$l]; } } elseif ($entry > $exit) { # Go backwards through the list for ($l = $exit; $l >= $entry; $l--) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$l]; } } elseif ($entry == $exit) { $point_name = self::cleanName($airways[$name][$l]->name); $allpoints[$point_name] = $airways[$name][$entry]; } # Now add the exit point, and increment the main counter by one if ($exit > -1) { $allpoints[$exit_name] = $airways[$name][$exit]; } continue; } else { /* This nav point already exists in the list, don't add it again */ if (isset($allpoints[$navpoints[$i]])) { continue; } /* Means it is a track, so go into processing it See if it's something like XXXX/YYYY */ if (substr_count($navpoints[$i], '/') > 0) { $name = $navpoints[$i]; $point_name = explode('/', $name); preg_match(self::$nat_pattern, $point_name[0], $matches); $coord = $matches[1]; $lat = $matches[2] . $coord[0] . $coord[1] . '.' . $coord[2] . $coord[3]; /* Match the second set of coordinates */ # Read the second set preg_match(self::$nat_pattern, $point_name[1], $matches); if ($matches == 0) { continue; } $coord = $matches[1]; $lng = $matches[2] . $coord[0] . $coord[1] . $coord[2] . '.' . $coord[3]; /* Now convert into decimal coordinates */ $coords = $lat . ' ' . $lng; $coords = Util::get_coordinates($coords); if (empty($coords['lat']) || empty($coords['lng'])) { unset($allpoints[$navpoints[$i]]); continue; } $tmp = new stdClass(); $tmp->id = 0; $tmp->type = NAV_TRACK; $tmp->name = $name; $tmp->title = $name; $tmp->lat = $coords['lat']; $tmp->lng = $coords['lng']; $tmp->airway = ''; $tmp->sequence = 0; $tmp->freq = ''; $allpoints[$navpoints[$i]] = $tmp; unset($point_name); unset($matches); unset($tmp); } else { $allpoints[$navpoints[$i]] = $navpoints[$i]; $navpoint_list[] = $navpoints[$i]; } } } $navpoint_list_details = self::getNavDetails($navpoint_list); foreach ($navpoint_list_details as $point => $list) { $allpoints[$point] = $list; } unset($navpoint_list_details); /* How will this work - loop through each point, and decide which one we'll use, determined by the one which is the shortest distance from the previous Go in the order of the ones passed in. */ foreach ($allpoints as $point_name => $point_details) { if (is_string($point_details)) { unset($allpoints[$point_name]); continue; } if (!is_array($point_details)) { continue; } $results_count = count($point_details); if ($results_count == 1) { $allpoints[$point_name] = $point_details[0]; } elseif ($results_count > 1) { /* There is more than one, so find the one with the shortest distance from the previous point out of all the ones */ $index = 0; $dist = 0; /* Set the inital settings */ $lowest_index = 0; $lowest = $point_details[$lowest_index]; $lowest_dist = SchedulesData::distanceBetweenPoints($fromlat, $fromlng, $lowest-> lat, $lowest->lng); foreach ($point_details as $p) { $dist = SchedulesData::distanceBetweenPoints($fromlat, $fromlng, $p->lat, $p-> lng); if ($dist < $lowest_dist) { $lowest_index = $index; $lowest_dist = $dist; } $index++; } $allpoints[$point_name] = $point_details[$lowest_index]; } $fromlat = $allpoints[$point_name]->lat; $fromlng = $allpoints[$point_name]->lng; } return $allpoints; } If anyone has any ideas I'm all ears--been plugging at this for about a week now. Every single airway that is punched into route works without issue if the entry sequence number is less than exit sequence number so that it's moving forward in gathering the waypoint info.
-
Yep; few posts up I posted about this -- he calls a function that is missing from phpvms (dunno why) but I re-added it and then his module worked fine. Here is the function you need to add back to that class file. /** * Update a pilot's pay. Pass the pilot ID, and the number of * hours they are being paid for * * @param int $pilotid The pilot ID * @param int $flighthours Number of hours to pay the pilot for * @return bool Success * */ public static function updatePilotPay($pilotid, $flighthours) { $sql = 'SELECT payrate FROM '.TABLE_PREFIX.'ranks r, '.TABLE_PREFIX.'pilots p WHERE p.rank=r.rank AND p.pilotid='.$pilotid; $payrate = DB::get_row($sql); $payupdate = self::getPilotPay($flighthours, $payrate->payrate); $sql = 'UPDATE '.TABLE_PREFIX.'pilots SET totalpay=totalpay+'.$payupdate.' WHERE pilotid='.$pilotid; DB::query($sql); if(DB::errno() != 0) return false; return true; }
-
Can you check your PilotData.class.php and search for "public static function updatePilotPay" See if that exists?
-
Can you post your pirepdata.class file? I recall when I integrated his (I use custom one now) way back at start the pirepdata file had the function in wrong spot so I ended up with pending pireps. I can look at it and reference my backups from last year.
-
So it's June. Where are we at with admin panels?
-
That is my pilot ID. There is no pilot ID 0 in my database--my pilotid start at 100 and increment. Keep in mind I'm referring to the column 'pilotid' in phpvms_pilots table.
-
That is what my code was too -- but even that throws an error with "Invalid Authorization."
-
Are you calling the acarsmap.php in iframe?
-
Line 26 is Auth::$userinfo->pilotid = 100; Also it appears this is still running regardless -- I just made bunch of fake bid's and set date back 5 days -- ran the script and all the bids were wiped out (I have 48 hour hold period). Guess I'll just ignore it.
-
I've read every thread on this--still can't find answer. Likely because no answer exists is my best guess -- but here's to trying ... When the maintenance file runs in CRON (I own the VPS I'm on) it throws error about authorization--pilot ID of an admin is 100. Here is error I get (it's formatted just like error if I go to file directly without being logged into the crew center.) If I am logged in and run the admin/maintenance.php it completes with no errors. PHP 5.6.4 PHP Warning: Creating default object from empty value in /var/www/vhosts/walkerair.us/httpdocs/crew/admin/maintenance.php on line 26 Warning: Creating default object from empty value in /var/www/vhosts/walkerair.us/httpdocs/crew/admin/maintenance.php on line 26 <div id="codon_crit_error" style="font-family: 'Lucida Sans',Verdana;border:#999 1px solid;background-color:#fff;padding:20px 20px 12px 20px;"> <h1 style="font-family: verdana; font-weight:16px;font-size:18px;color:#6B001B;margin:0 0 4px 0;">An Error Was Encountered</h1> <p style="font-size: 16px; color: #001B6B">Unauthorized access - Invalid Permissions.</p> <p style="font-size: 10px;"><center><a href="https://crew.walkerair.us">Return to Homepage</a></p> </div> Here is maintenance.php file <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ /* This is the maintenance cron file, which can run nightly. You should either point to this file directly in your web-host's control panel Or add an entry into the crontab file. I recommend running this maybe 2-3am, */ define('ADMIN_PANEL', true); include dirname(dirname(__FILE__)).'/core/codon.config.php'; Auth::$userinfo->pilotid = 100; error_reporting(E_ALL); ini_set('display_errors', 'on'); set_time_limit(0); ini_set('memory_limit', '-1'); /* Clear expired sessions */ Auth::clearExpiredSessions(); /* Update any expenses */ FinanceData::updateAllExpenses(); if(Config::Get('PILOT_AUTO_RETIRE') == true) { /* Find any retired pilots and set them to retired */ PilotData::findRetiredPilots(); CronData::set_lastupdate('find_retired_pilots'); } if(Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === true) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } MaintenanceData::optimizeTables(); MainController::Run('Maintenance', 'resetpirepcount'); MainController::Run('Maintenance', 'resethours');
-
@web541 It's only part of my JS. I didn't copy the whole thing. However, here is the entire thing. It works GREAT. /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ * * Rewritten for Google Maps v3 */ /** * */ function renderAcarsMap(opts) { let bounds = []; let selPath = []; let selPoints = [], selMarkers = []; let selDepMarker, selArrMarker, selPointsLayer, selPathLayer; let flightMarkers = []; let headingIcons = {}; let info_window = null; let run_once = false; opts = Object.assign({ render_elem: 'routemap', provider: 'OpenStreetMap.Mapnik', autozoom: false, zoom: 5, refreshTime: 12000, autorefresh: true }, opts); const map = createMap(opts); /** * Get the marker for a specific heading * @param {*} heading */ const getHeadingIcon = (heading) => { if (!(heading in headingIcons)) { headingIcons[heading] = L.icon({ iconUrl: url + "uploads/maps/heading/" + heading + ".png", iconSize: [35, 35] }); } return headingIcons[heading]; }; /** * Clear all of the markers and selected points */ const clearSelMarkers = () => { if (selDepMarker) { selDepMarker.remove(); selDepMarker = null; } if (selArrMarker) { selArrMarker.remove(); selArrMarker = null; } if (selPointsLayer) { selPointsLayer.remove(); selPointsLayer = null; } if (selPathLayer) { selPathLayer.remove(); selPathLayer = null; } for (let i in selMarkers) { selMarkers[i].remove(); } selPoints = []; selPath = []; }; /** * Draw the points/route for a flight * @param {*} features */ const flightClick = (flight) => { clearSelMarkers(); const depCoords = L.latLng(flight.deplat, flight.deplng); selDepMarker = L.marker(depCoords, { icon: MapFeatures.icons.departure, }).addTo(map); const arrCoords = L.latLng(flight.arrlat, flight.arrlng); selArrMarker = L.marker(arrCoords, { icon: MapFeatures.icons.arrival, }).addTo(map); selPoints.push(depCoords); $.each(flight.route_details, function(i, nav) { const loc = L.latLng(nav.lat, nav.lng); const icon = (nav.type === 3) ? MapFeatures.icons.vor : MapFeatures.icons.fix; selPoints.push(loc); const marker = L.marker(loc, { icon: icon, title: nav.title, }) .bindPopup(tmpl("navpoint_bubble", { nav: nav })).on("popupopen", () => { $(".leaflet-popup-close-button").on("click", e => { clearSelMarkers(); }) }) .addTo(map); selMarkers.push(marker); }); selPoints.push(arrCoords); selPointsLayer = L.geodesic([selPoints], { weight: 3, opacity: 0.3, color: '#000000', steps: 4 }).addTo(map); /*map.fitBounds(selPointsLayer.getBounds(),{padding: [200, 200]});*/ /* Attempt to show flight path */ $.post("/action.php/trackflight/getposreps", { pilotid: flight.pilotid.substring(3), flightnum: flight.flightnum }) .done(function( dirflts ) { $.each(dirflts, function(i, nav) { if(nav.latitude === undefined || nav.longitude === undefined) { return; } const ploc = L.latLng(nav.latitude, nav.longitude) selPath.push(ploc); }); selPathLayer = L.geodesic([selPath], { weight: 4, opacity: 0.5, color: 'red', steps: 8 }).addTo(map); }); }; /** * * @param {*} data */ const populateMap = (data) => { clearMap(); $("#pilotlist").html(""); /*if (data.length == 0) { return false; }*/ if (data.length == 0) { $("#acars_map_divider").hide(); $("#acars_map_table").hide(); // Or .css("display", "none"); return false; } $("#acars_map_divider").hide(); $("#acars_map_table").show(); // or .css("display", "block"); let lat, lng; let details, row, pilotlink; bounds = []; $.each(data, function(i, flight) { if (flight == null || flight.lat == null || flight.lng == null || flight.lat == "" || flight.lng == "") { return; } flight.lat = Number(flight.lat); flight.lng = Number(flight.lng); lat = flight.lat; lng = flight.lng; if (i % 2 == 0) flight.trclass = "even"; else flight.trclass = "odd"; // Pull ze templates! const map_row = tmpl("acars_map_row", { flight: flight }); const detailed_bubble = tmpl("acars_map_bubble", { flight: flight }); $('#pilotlist').append(map_row); const pos = L.latLng(lat, lng); const marker = L.marker(pos, { icon: getHeadingIcon(flight.heading), zIndexOffset: 1000, }) .on('click', (e) => { flightClick(flight); }) .bindPopup(detailed_bubble).on("popupopen", () => { $(".leaflet-popup-close-button").on("click", e => { clearSelMarkers(); }) }) .addTo(map); flightMarkers.push(marker); bounds.push(pos); /* Clear everything when Popup closes */ /* marker.getPopup().on('remove', function() { clearSelMarkers(); /*map.setZoom(opts.zoom);*/ /*});*/ }); // If they selected autozoom, only do the zoom first time if (opts.autozoom == true && run_once == false) { map.fitBounds(bounds); run_once = true; } } /** * Clear all markers and layers */ const clearMap = () => { // clear markers for (let i in flightMarkers) { flightMarkers[i].remove(); } }; /** * */ const liveRefresh = () => { $.ajax({ type: "GET", url: url + "/action.php/acars/data", dataType: "json", cache: false, success: function(data) { populateMap(data); } }); }; /** * Render * */ liveRefresh(); if (opts.autorefresh == true) { setInterval(function() { liveRefresh(); }, opts.refreshTime); } }
-
Edited to use the data from CC Flight Tracker (which is really their functions pushing data in the rawdata field.)
-
It's working exactly as I wanted now. The file above is the acarsmap.js
-
@web541 @ProAvia Ok; so couple things I figured out and fixed -- the navaid rawdata column parsing issue was a db timeout setting (actually on MySQL). I fixed that sometime yesterday because when I tried to run the navdata fsbuild script I would get "mysql server gone away." I suspect that fixed it since now I got the rawdata column populated with the BOCAP waypoint. Now a new twist of events; I saw the navaid on the ACARS live flight map but not on PIREP. Got to looking at code and noticed this; // rendering for if there's smartcars data if(flight.rawdata instanceof Object && flight.rawdata.points !== undefined && Array.isArray(flight.rawdata.points) ) { $.each(flight.rawdata.points, function(i, nav) { if(nav.lat === undefined || nav.lng === undefined) { return; } path.push(L.latLng(nav.lat, nav.lng)); }); } else { $.each(flight.route_details, function(i, nav) { const loc = L.latLng(nav.lat, nav.lng); const icon = (nav.type === 3) ? MapFeatures.icons.vor : MapFeatures.icons.fix; points.push(loc); const marker = L.marker(loc, { icon: icon, title: nav.title, }) .bindPopup(tmpl("navpoint_bubble", { nav: nav })) .addTo(map); }); } I'm not good with JS but the IF/ELSE is pretty explainable--however I want both route data and flight path data--so I removed the "ELSE" statement and now my PIREP map shoulds navaids and the flown path. // rendering for if there's smartcars data if(flight.rawdata instanceof Object && flight.rawdata.points !== undefined && Array.isArray(flight.rawdata.points) ) { $.each(flight.rawdata.points, function(i, nav) { if(nav.lat === undefined || nav.lng === undefined) { return; } path.push(L.latLng(nav.lat, nav.lng)); }); } $.each(flight.route_details, function(i, nav) { const loc = L.latLng(nav.lat, nav.lng); const icon = (nav.type === 3) ? MapFeatures.icons.vor : MapFeatures.icons.fix; points.push(loc); const marker = L.marker(loc, { icon: icon, title: nav.title, }) .bindPopup(tmpl("navpoint_bubble", { nav: nav })) .addTo(map); });
-
@web541any idea where I would start looking? I ran SQL search on name = "BOCAP" and pulled it up. It's not just this 1; I've seeing more in pirep table that are like that. Just wondering if it's an optimization issue or something? Maybe I'm not letting it run long enough to search 80k rows? I'm on a VPS so I got plenty of power--just wondering now if maybe php or MySql isn't configured right.
-
Here you go. https://imgur.com/a/jnvvVpl I cross checked the data to ForeFlight; the fix is right from lat/lng.
-
Is there way to debug that to see why? I'm just curious if it's because the navaid is at ID 82,345 (something insane like that.)
-
What causes the route_details column to be empty on a pirep? I have detected that PIREPS like this don't show navaids on the PIREP map. a:0:{} I dont' quite understand the reason because I see it on some that have 1 navaid, or 4 navaids--but then I have another with 4 navaids and route details showing. Ignore the one in image that says "Enter"; pilot didn't actually enter route from Simbrief. Low down: basically any PIREP with route_details that only has "a:0:{}" shows zero navaids on map. Let's look at bottom one; ID #91 with route BOCAP -- that is valid fix that I pulled from ForeFlight (on my table) to go from KCRG to KGNV -- it is in my navdata database with correct lat/lon; type = 5. It doesn't show at all. Here is a image of my table. https://imgur.com/a/21toxlU
-
Disregard my question. I ended up biting bullet and buying it-- LOVE IT. It integrated my flight path into my existing pirep report with not much work. I added extra set of paths so now I show actual flight path and then route path (if they put their route in.) I'm working on the live map now. I want it to show their actual path as well. @shakamonkey88 did you ever integrate flight path onto the ACARS map that Nabeel released with OSM migration? I'm curious about it--still digging through code looking at how flight tracker pulls the data.