IF to KML Script

IFtoKML

IFtoKML is a Python script that retrieves the flight information from flight simulator Infinite Flight and writes it to a KML file that can be viewed in Google Earth.

Usage: Generate 3D Flight Plans of previous flights that can be viewed in Google Earth. This script requires basic knowledge of Python(Downloading modules) and Python3 installed.

This is a tracked flight (KLGB-KNUC) previously recorded and opened in Google Earth Pro:

Downloading the script

Download the files attached to the GitHub release found here

Required modules

Please be sure to have all the required modules installed for the script to work as intended:

  • IFConnectOld
  • datetime
  • pytz
  • keyboard

Using the script

Just run it! Running the script will connect to a running instance of Infinite Flight on your WiFi. It will ask you to input a interval for sending and receiving data from the sim. For slower aircraft and/or slower internet connection aim for a higher value(ex. 5 seconds) while 1 second will provide the best model. It will then prompt you to enter a starting point. Enter this point when and only when you are ready to start tracking. The script will then receive information from the sim every interval. When the flight is complete and you have parked, just press space a couple times to end the flight tracking and enter a stop point. The file will be saved to the directory of the script, named with the date and time of start.

Examples;
The following example shows what the script will ask you for when running:

('xxx.xxx.x.xxx', xxxxx) [SOCKET CONNECTED to xxx.xxx.x.xxx on port xxxxx] Success
========================================

How often do you want to send/receive data(seconds): 1
Chosen interval = 1.0 seconds
Outbound Airport(Enter when ready to push): KSFO

The following example shows what the script will do when tracking a flight:

Press "   " to end flight
('xxx.xxx.x.xxx', xxxxx) [SENDING REQUEST to xxx.xxx.x.xxx : xxxxx] {"Command": "airplane.getstate", "Parameters": []}
('xxx.xxx.x.xxx', xxxxx) [AWAITING RESPONSE from xxx.xxx.x.xxx : xxxxx] Request has been sent to Infinite Flight
('xxx.xxx.x.xxx', xxxxx) [RESPONSE RECIEVED from xxx.xxx.x.xxx : xxxxx]

Press "   " to end flight
('xxx.xxx.x.xxx', xxxxx) [SENDING REQUEST to xxx.xxx.x.xxx : xxxxx] {"Command": "airplane.getstate", "Parameters": []}
('xxx.xxx.x.xxx', xxxxx) [AWAITING RESPONSE from xxx.xxx.x.xxx : xxxxx] Request has been sent to Infinite Flight
('xxx.xxx.x.xxx', xxxxx) [RESPONSE RECIEVED from xxx.xxx.x.xxx : xxxxx]

Press "   " to end flight
('xxx.xxx.x.xxx', xxxxx) [SENDING REQUEST to xxx.xxx.x.xxx : xxxxx] {"Command": "airplane.getstate", "Parameters": []}
('xxx.xxx.x.xxx', xxxxx) [AWAITING RESPONSE from xxx.xxx.x.xxx : xxxxx] Request has been sent to Infinite Flight
('xxx.xxx.x.xxx', xxxxx) [RESPONSE RECIEVED from xxx.xxx.x.xxx : xxxxx]

Press "   " to end flight
('xxx.xxx.x.xxx', xxxxx) [SENDING REQUEST to xxx.xxx.x.xxx : xxxxx] {"Command": "airplane.getstate", "Parameters": []}
('xxx.xxx.x.xxx', xxxxx) [AWAITING RESPONSE from xxx.xxx.x.xxx : xxxxx] Request has been sent to Infinite Flight
('xxx.xxx.x.xxx', xxxxx) [RESPONSE RECIEVED from xxx.xxx.x.xxx : xxxxx]

The following example shows what the script will do when you end the tracking:

Inbound Airport(Enter when parked): KLAX
('xxx.xxx.x.xxx', xxxxx) [SENDING REQUEST to xxx.xxx.x.xxx : xxxxx] {"Command": "airplane.getstate", "Parameters": []}
('xxx.xxx.x.xxx', xxxxx) [AWAITING RESPONSE from xxx.xxx.x.xxx : xxxxx] Request has been sent to Infinite Flight
('xxx.xxx.x.xxx', xxxxx) [RESPONSE RECIEVED from xxx.xxx.x.xxx : xxxxx]



 IF 210717 12.49.56z.kml  sucessfully recorded
9 Likes

Wow! This is is really cool! Getting a path in 2D is hard enough, so this is amazing!

1 Like

Updated the script for some bug fixes

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.