cannot get flight map data


#1

Hello,

I am trying to get a flight map using method “http://flightxml.flightaware.com/soap/FlightXML2/doc#op_MapFlight”. I have used random tail numbers (AWE605, AWE2063) and I simply cannot get any data back from the API.
I also tried to use method “DecodeFlightRoute” with the faFlightID retrieved using method FlightInfoEx and that returns an error message: {“error”:“no data available”}.
Can you help?

Regards,
Paul


#2

Not all flight routes can be successfully processed by DecodeFlightRoute, such as if the route involves nav aids that are out of date or located outside of the United States. Occasionally routes entered by pilots or ATC will also have a typo in one of the nav aids, which can cause decoding to fail. You may need to write your application to accommodate the possibility that DecodeFlightRoute will not be possible for all flights.

MapFlight will only work for flights that are currently in the air. You can also try MapFlightEx (which takes a faFlightID instead of just an ident), which can render a map for flights that either still in the air, or have already landed.


#3

Thanks for getting back to me.

I tried to use MapFlightEx but it requires me to specify all parameters (even the optional ones) otherwise I get a SOAP error. Since there is no example in the documentation I am not sure how values for certain parameters (layer_on, layer_off, latlon_box) should be defined in PHP.

Do you have an example I could use?


#4

Here’s an example for MapFlightEx in PHP:


$params = array("faFlightID" => $flight_id,
                "mapWidth" => 640, 
                "mapHeight" => 480, 
                "layer_on" => array("US urban areas", "US Cities"),
                "layer_off" => array("US state boundaries"), 
                "show_data_blocks" => 0, 
                "show_airports" => 1, 
                "airports_expand_view" => 0, 
                "latlon_box" => array(0, 0, 45, 45) 
                );
$result = $client->MapFlightEx($params);



#5

Thanks for that. Now I can see the map. But I only see the 2 airports. I don’t see the icon of the plan or the itinerary as I would see on flightaware.com/live/flight/PDT4110
Any thoughts as to why that may be?


#6

Ensure you are using the faFlightID of an enroute or past flight. The FlightInfoEx function returns multiple flights and the first result is usually one that is still in the future, so no data other than the origin and destination airport are known yet.


#7

I tried with the following tail numbers: PDT4110, SKW5552, DAL736
These were all in-flight when I tested with them.
What I do when I want to get a tail number is: I go to “Live Flight Tracking->Random Flight” and whatever your site returns is what I use.
So it’s always an en-route flight.


#8

PDT4110, SKW5552, DAL736 are all flight idents (not faFlightID, which represents a specific instance of a flight by that ident). Examples of completed faFlightIDs for those 3 idents are: PDT4110-1377495376-airline-0391, SKW5552-1377583255-620-0, DAL736-1377322256-airline-0071


#9

For PDT4110 the faFlightID that I received from FlightInfoEx is PDT4110-1377668587-airline-0677
I just tried with PDT4110-1377495376-airline-0391 and indeed I can see the itinerary of the aircraft, but I don’t understand how come you got a different faFlightID than I got.

Just a couple of seconds ago I tried with flightaware.com/live/flight/AAL1301
I got this faFlightID: AAL1301-1377668032-airline-0386
But the map still shows only the 2 airports, no itinerary and no aircraft.


#10

As I said before, FlightInfoEx will return multiple flights (some which might be still in the future). You need to look at the filed_departuretime and other time fields in all of the flights returned by FlightInfoEx to pick which flight you are actually interested in.

PDT4110-1377668587-airline-0677 is a future flight that departs in 45 hours. AAL1301-1377668032-airline-0386 is a future flight that departs in 47 hours.


#11

Ok, but if you go to flightaware.com/live/flight/AAL1301 you’ll see the flight is en-route.
This is the response from FlightInfoEx:

object(stdClass)#2 (1) {
“FlightInfoExResult”]=>
object(stdClass)#3 (2) {
“next_offset”]=>
int(1)
“flights”]=>
object(stdClass)#4 (20) {
“faFlightID”]=>
string(31) "AAL1301-1377668032-airline-0386"
“ident”]=>
string(7) "AAL1301"
“aircrafttype”]=>
string(4) "MD83"
“filed_ete”]=>
string(8) "02:20:00"
“filed_time”]=>
int(1377668032)
“filed_departuretime”]=>
int(1377881100)
“filed_airspeed_kts”]=>
int(369)
“filed_airspeed_mach”]=>
string(0) “”
“filed_altitude”]=>
int(0)
“route”]=>
string(0) “”
“actualdeparturetime”]=>
int(0)
“estimatedarrivaltime”]=>
int(1377890100)
“actualarrivaltime”]=>
int(0)
“diverted”]=>
string(0) “”
“origin”]=>
string(4) “KDFW”
“destination”]=>
string(4) “KSLC”
“originName”]=>
string(22) “Dallas/Fort Worth Intl”
“originCity”]=>
string(21) “Dallas-Fort Worth, TX”
“destinationName”]=>
string(19) “Salt Lake City Intl”
“destinationCity”]=>
string(18) “Salt Lake City, UT”
}
}
}


#12

Our website tries to intelligently guess which flight instance you are interested in when you visit a page such as flightaware.com/live/flight/AAL1301 The flight instance that is selected will be the one currently en-route, or the next upcoming flight if there is one. If you look at the bottom of that page there is a listing of known instances of that flight, including some future ones, the “current” one, and some past ones. You can click on any of those past/future flights to view them. The “current” flight is not necessarily the top one in that list.

FlightInfoEx returns all known flight instances, sorted by time descending. If you say howMany=1 for FlightInfoEx, you are probably not going to get back enough flights to be able to find the “current” one.

The details for the flight that you pasted has not departed yet (notice “actualdeparturetime” = 0). Also, the “filed_departuretime” is 1377881100 (which is Fri Aug 30 16:45:00 GMT 2013, ie: in the future still).


#13

Thanks a lot for your help. I managed to get it working and now I have an image of a map with the itinerary and the aircraft.
I was wondering if there is any way I can generate a map like the one that is available on your site, you know, the interactive one where you can zoom out and in. Based on some of your previous comments (like the possible issues when using method DecodeRoute) I’m not sure exactly how/if it can be done.


#14

Our interactive javascript maps are not available for reuse through FlightXML. However, you can implement your own using Google Maps or Bing Maps javascript APIs.

There is an Javascript jQuery example in the JSON/REST section of flightaware.com/commercial/fligh … ation2.rvt that makes use of the Google Maps API, which you might be able to use as a starting point. Although that example also happens to performs the FlightXML API request within Javascript, you can modify the code so that the FlightXML request is made through PHP on your server and embeds the lat/lon positions within the HTML/Javascript that is emitted into the page.


#15

Thanks for that, but your JS example uses DecodeFlightRoute and some of your previous comments pointed out that it’s not 100% safe to use that method as sometimes it will not be able to decode the information about the flight. Did I misunderstand?


#16

One other thing. How safe is it to use “InFlightInfo”?


#17

“safe” or “unsafe” cannot universally be applied to any function. In all cases for all functions, your application should have robust error handling and be prepared for network errors, no results returned, multiple results returned, fields that are sometimes blank/zero, etc. Data is returned if it is available, but any live data source (including aviation data) is inherently noisy and prone to aberrations.


#18

Thanks for that.

I used the InFlightInfo method for flight “AWI4030” and it worked great yesterday.
This is the information about the flight:
object(stdClass)#7 (20) {
“faFlightID”]=>
string(31) "AWI4030-1378186532-airline-0406"
“ident”]=>
string(7) "AWI4030"
“aircrafttype”]=>
string(3) “CRJ”
“filed_ete”]=>
string(8) "01:38:00"
“filed_time”]=>
int(1378388839)
“filed_departuretime”]=>
int(1378388700)
“filed_airspeed_kts”]=>
int(382)
“filed_airspeed_mach”]=>
string(0) “”
“filed_altitude”]=>
int(290)
“route”]=>
string(44) "DITCH J225 JFK CAM J222 PLB YSC ROGSA ROGSA2"
“actualdeparturetime”]=>
int(1378389420)
“estimatedarrivaltime”]=>
int(1378394520)
“actualarrivaltime”]=>
int(1378394520)
“diverted”]=>
string(0) “”
“origin”]=>
string(4) “KPHL”
“destination”]=>
string(4) “CYQB”
“originName”]=>
string(17) “Philadelphia Intl”
“originCity”]=>
string(16) “Philadelphia, PA”
“destinationName”]=>
string(24) “Quebec/Jean Lesage Int’l”
“destinationCity”]=>
string(19) “Quebec City, Quebec”
}

Today I can’t even get the coordinates for the route (“DITCH J225 JFK CAM J222 PLB YSC ROGSA ROGSA2”).

I tried DecodeFlightRoute and I get Soap error message “cannot decode route”.
I tried DecodeRoute and the same thing.

Then I tried to get each airport on the route and call AirportInfo and for most airports it cannot find the airport. For the ones it can I get the right coordinates in most cases, but for one airport in the route (“CAM”) I get coordinates in SouthAmerica (Object { latitude=-20.006111, longitude=-63.527778, code=“CAM”}) which is weird since this flight is in the US.


#19

The terms that appear within the “route” string are not airport codes. They are either radio navaids (VOR, NDB, etc), intersection names, approach or departure procedure names, airways, jetways, etc. As such, you cannot simply attempt to use AirportInfo on each of those terms, even though you may recognize some of them as also existing as airport codes (ie: the “JFK” entry is the VOR that happens to be located near KJFK airport).

In this particular case, the route “DITCH J225 JFK CAM J222 PLB YSC ROGSA ROGSA2” cannot be decoded because we are unable to identify the points starting from “YSC”. The destination airport is “CYQB”, which is outside of the US, and we currently don’t have Canadian navaids in our decoding database.


#20

I just wanted to also ensure that you’re clear that the “route” represents the planned flight path that the aircraft is intended to fly, and not the actual path that is taken.

If you want to graph the actual path, you can use either GetHistoricalTrack or SearchBirdseyePositions to retrieve the true lat/lon positions for a specific faFlightID.