# Get Flight Map image

**URL:** <https://discussions.flightaware.com/t/get-flight-map-image/14948>\
**Category:** AeroAPI\
**Created:** [February 27, 2014, 7:33am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948 "2014-02-27T07:33:18Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [February 27, 2014, 7:33am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/1 "2014-02-27T07:33:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [February 27, 2014, 8:04pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/2 "2014-02-27T20:04:06Z")

</div>

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](http://flightxml.flightaware.com/soap/FlightXML2/doc#op_MapFlight)  
[flightxml.flightaware.com/soap/F … apFlightEx](http://flightxml.flightaware.com/soap/FlightXML2/doc#op_MapFlightEx)

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [February 27, 2014, 8:36pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/3 "2014-02-27T20:36:44Z")

</div>

I am using below url

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

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

```auto

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 ?

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [February 27, 2014, 9:01pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/4 "2014-02-27T21:01:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [February 28, 2014, 12:29am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/5 "2014-02-28T00:29:07Z")

</div>

same issue…below is my complete code

```auto

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

```

**Any suggestion ?**

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [February 28, 2014, 6:22pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/6 "2014-02-28T18:22:16Z")

</div>

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

```auto

 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.

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [February 28, 2014, 8:05pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/7 "2014-02-28T20:05:49Z")

</div>

I have prepared one application here

[cwsi.net/flightdetails/](http://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](http://flightaware.com/live/flight/DAL1662/history/20140228/1615Z/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 ?

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [February 28, 2014, 8:11pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/8 "2014-02-28T20:11:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [February 28, 2014, 9:52pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/9 "2014-02-28T21:52:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [February 28, 2014, 9:56pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/10 "2014-02-28T21:56:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [March 2, 2014, 2:28am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/11 "2014-03-02T02:28:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [March 2, 2014, 3:35am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/12 "2014-03-02T03:35:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [March 2, 2014, 5:18am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/13 "2014-03-02T05:18:02Z")

</div>

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

```auto

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 ?

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [March 2, 2014, 6:31am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/14 "2014-03-02T06:31:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [March 2, 2014, 10:01pm UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/15 "2014-03-02T22:01:16Z")

</div>

AirlineFlightSchedules will not return me the Map data ?

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [March 3, 2014, 2:41am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/16 "2014-03-03T02:41:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [March 3, 2014, 2:58am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/17 "2014-03-03T02:58:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [March 3, 2014, 3:24am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/18 "2014-03-03T03:24:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pankajgarg10](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@pankajgarg10](https://discussions.flightaware.com/u/pankajgarg10)\
**Post date:** [March 3, 2014, 3:36am UTC](https://discussions.flightaware.com/t/get-flight-map-image/14948/19 "2014-03-03T03:36:09Z")

</div>

Thanks. Please close this thread
