Where can I find the route, rather than the path?

In the API overview, there are references to a route ID in the FlightPlans function. I’m guessing that this could be used to compare a plane’s actual path to an intended path, but how could I get a list of points for the route? On flightaware.com these are represented as a dashed blue line so I know the data exists somewhere.

I’m not sure which function you’re referring to, since we don’t have one called “FlightPlans”. See our listing of functions.

However, FlightInfo, FlightInfoEx, and SearchBirdseyeInFlight all return a structure that contains a “route” member which is a string that describes the route that was filed in the flight plan. This route string lists the way points and nav aids by their names, but if you would like actual lat/lon positions that correspond to those points, you can use our DecodeRoute function to do that. (There is also a DecodeFlightRoute function if you already know the faFlightID of the desired flight.)

Then you could plot that list of planned way points next to the actual flight path that was taken, as returned by GetHistoricalTrack (which takes a faFlightID), GetLastTrack, or SearchBirdseyePositions.

Hi,

Thanks for the answer - looks like I’ve gotten myself confused between FlightAware and Flightwise, FlightXML and PlaneXML. Been looking at this, trying to find routes: flightwise.com/documentation/39/ … rence.html

Sorry, that is confusing – Flightwise copied FlightXML (in some cases word for word) and named their product “PlaneXML.” As a result, everything is very similar except that the Flightwise version isn’t as good and costs more.

I would recommend using FlightXML2, especially until Flightwise copies our new features, in which case we will re-evaluate. :slight_smile:

If you’d like a quick FlightXML example that plots the planned route of a flight, here’s one I made in PHP and the Google Maps API:



<?php
# This example uses: 
# * the FlightXML2 FlightInfoEx and DecodeFlightRoute functions: 
#      http://flightaware.com/commercial/flightxml/
# * the built-in SoapClient provided in PHP5:
#      http://us2.php.net/SoapClient
# * Google Maps API: 
#      http://code.google.com/apis/visualization/documentation/gallery/map.html

$options = array(
                 'trace' => true,
                 'exceptions' => 0,
                 'login' => 'YOUR_USERNAME',
                 'password' => 'YOUR_FLIGHTXML_APIKEY',
                 );
$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);

$params = array("ident" => "SWA29", "howMany" => 1, "offset" => 0);
$result = $client->FlightInfoEx($params);
if (!isset($result) || empty($result)) {
  die("Error while getting faFlightID");
}

$params = array("faFlightID" => $result->FlightInfoExResult->flights->faFlightID);
$result = $client->DecodeFlightRoute($params);

if (!isset($result) || empty($result)) {
  die("Error while getting route");
}
$routePoints = $result->DecodeFlightRouteResult->data;

function emitMapData() {
    global $routePoints;
    print "  data.addRows(" . count($routePoints) . ");
";

    $rowid = 0;
    foreach ($routePoints as $row) {
      print "  data.setCell($rowid, 0, $row->latitude);
";
      print "  data.setCell($rowid, 1, $row->longitude);
";
      print "  data.setCell($rowid, 2, '$row->name ($row->type)');
";
      $rowid++;
    }
}

?>

<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
google.load("visualization", "1", {packages:"map"]});
google.setOnLoadCallback(drawMap);
function drawMap() {
  var data = new google.visualization.DataTable();
  data.addColumn('number', 'Lat');
  data.addColumn('number', 'Lon');
  data.addColumn('string', 'Name');

  <?php emitMapData() ?>

  var map = new google.visualization.Map(document.getElementById('map_div'));
  map.draw(data, {showTip: true, showLine: true, lineWidth: 5, lineColor: '#009900'});
}
    </script>
  </head>

  <body>
    <div id="map_div" style="width: 400px; height: 300px"></div>
  </body>

</html>


It displays a map for SWA29 (Southwest airlines flight 29) and lets you click on the points to see the waypoints along the route: