Get Flight Map image


#1

i want to be able to put in flight number and see a map of the flight. Is it possible in c# ?
Any sample demo or working code will be really appreciable.


#2

MapFlight and MapFlightEx will return image data for a static server-side rendered map of the specified flight or flight id.

flightxml.flightaware.com/soap/F … _MapFlight
flightxml.flightaware.com/soap/F … apFlightEx


#3

I am using below url

url = String.Format(“http://UserName:ApiKey@flightxml.flightaware.com/json/FlightXML2/MapFlightEx?faFlightID={0}”, faFlightId);

I am using my credentials…It’s returning me a string…
I am trying to convert the string to Byte Array
like below


FileResult GetBytes(string str)
{
    byte] bytes = new byte[str.Length * sizeof(char)];
    System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
}

and trying to download it as a file
but, the file is coming inValid…Am I doing something wrong ?


#4

It is not JPG for the extension. Try PNG or GIF.


#5

same issue…below is my complete code


FileResult GetBytes(string str)
{
    byte] bytes = new byte[str.Length * sizeof(char)];
    System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
}

Any suggestion ?


#6

I believe you’re still omitting the Base64 decoding. Probably something like this:


 byte] bytes = System.Convert.FromBase64String(str);

Also, be aware that taking the first flight returned by FlightInfoEx will generally not be very interesting to map, since that is generally a flight in the future that has not yet occurred.


#7

I have prepared one application here

cwsi.net/flightdetails/

We have the option here in this page to fill the ident and we get the map

Ident is: DAL1662

Now, the problem is: I can see the flight details completely in below link

flightaware.com/live/flight/DAL1 … /KSAN/KATL

but not able to check in my link as the green line is not visible between two airports.

Why there is variation between these two links ?


#8

As I said, taking the first flight returned by FlightInfoEx will generally not be very interesting to map, since that is generally a flight in the future that has not yet occurred. You will need to be sure you are picking the flight from FlightInfoEx that corresponds to the correct day that you want. Specifying howMany > 1 will let you retrieve more than one flight.


#9

I am getting some Json Data

{“faFlightID”:“DAL1662-1393569272-airline-0226”,“ident”:“DAL1662”,“aircrafttype”:“B763”,“filed_ete”:“03:42:00”,“filed_time”:1393569272,“filed_departuretime”:1393776900,“filed_airspeed_kts”:444,“filed_airspeed_mach”:"",“filed_altitude”:0,“route”:"",“actualdeparturetime”:0,“estimatedarrivaltime”:1393790820,“actualarrivaltime”:0,“diverted”:"",“origin”:“KSAN”,“destination”:“KATL”,“originName”:“San Diego Intl”,“originCity”:“San Diego, CA”,“destinationName”:“Hartsfield-Jackson Intl”,“destinationCity”:“Atlanta, GA”}

Can you tell us the format used for filed_time?
Can you tell us the format used for filed_departuretime?


#10

All timestamps are UNIX Epoch seconds since Jan 1, 1970 00:00:00 UTC.


#11

The FlightXMl is showing only the past flights…Is it possible to check the future flights ?


#12

Status is only available for future flights a few hours (sometimes up to 24 hours) in the future. It’s not possible to know the status of flights further than that, as even the airline don’t truly know that far in advance.


#13

I am getting those flights whose status is 3 days past. Following is the query


http://UserName:APIKey@flightxml.flightaware.com/json/FlightXML2/MapFlightEx?faFlightID={0}&show_airports=true&show_data_blocks=true&airports_expand_view=true&mapHeight=1000&mapWidth=1000

Am I missing something ?


#14

Scheduled flights for most major airlines are published in advance by 6-12 months and are revised monthly. These scheduled flights can be accessed by the “AirlineFlightSchedules” function.

As the time prior to each flight approaches, we create placeholders for flights based on the scheduled flights approximately 2-3 days ahead of time so that it is easier for users to create alerts and begin monitoring them via FlightXML. At approximately 2 to 24 hours before the flight, the airline will actually file the flight plan, which is published into the ATC system with the actual details and updated departure time, including any actual delays that they are planning for.

FlightAware will detect airport-wide delays and apply our own automated modifications to the estimated times of flights (before or after the airline actually files the flight plan), but that is generally only possible for the same day as the flight.


#15

AirlineFlightSchedules will not return me the Map data ?


#16

Correct. There is fundamentally nothing known about flights that can be mapped other than origin and destination. The desired route and waypoints are not published until the flight plan is filed (just a few hours before flight). You fundamentally should not have the expectation of being able to map flights that have not departed yet.


#17

I understand that. I meant to say: Is the path for plane map is not predefined ?


#18

Absolutely not. Flight routes for the same flight number vary slightly each day, in response to weather and various other factors. Airlines have rooms full of people dedicated just to flight planning in order to optimize this process using all available information and eliminate the need for the pilots to do it themselves. Thunderstorms may cause subtle changes around the most intense parts. Strong headwinds might cause a flight to be made far off from the most direct great-circle path in order to optimize fuel burn. Political unrest may require flying around rather than over a country or block of airspace. High amounts of air traffic in one sector of airspace may require some flights to deviate slightly. etc.


#19

Thanks. Please close this thread