# Feeding Data to LiveTraffic

{% hint style="warning" %}
This page is yet a stub and requires more details.
{% endhint %}

Here are two sources in the meantime:

* [Here is a Support Forum thread](https://forums.x-plane.org/index.php?/forums/topic/218238-injecting-own-traffic-data-into-live-traffic-plugin/) discussing feeding data. That was the time when the `SendTraffic.py` script started to take shape. It discussing a few technical backgrounds.
* The script to feed data is provided with LiveTraffic since v2.50 and is `Resources/SendTraffic.py`.&#x20;

For using `SendTraffic.py` you obviously need [Python](https://www.python.org/downloads/), probably version 3.6+, tested on 3.8. ([Here's a thread](https://forums.x-plane.org/index.php?/forums/topic/218238-injecting-own-traffic-data-into-live-traffic-plugin/\&do=findComment\&comment=2148802) on using Python 3.5.)

Then run `SendTraffic.py -h` for getting the following help:

**usage:** `SendTraffic.py [-h] [-a HEX_LIST] [-d NUM_LIST] [-b NUM] [--historic NUM] [-l] [--host NAME_OR_IP] [--port NUM] [--weatherPort NUM] [-v] [inFile]`

SendTraffic 1.0: Sends air traffic tracking data from a file out on a UDP port for LiveTraffic to receive it on the RealTraffic channel. In LiveTraffic, activate the ["RealTraffic" channel (legacy mode via app) ](https://twinfan.gitbook.io/livetraffic/setup/installation/realtraffic-connectivity#id-3.-in-livetraffic-enable-the-realtraffic-channel)to receive the data and have it displayed as moving planes. From LiveTraffic, you can also export tracking data in a matching format using the [options "Export Tracking Data" and/or "Export User Aircraft"](https://twinfan.gitbook.io/livetraffic/setup/configuration/settings-advanced#export). The latter allows you to fly yourself and have your aircraft's movements written as tracking data. Data is written to `Output/LTExportFD - <timestamp>.csv`.

**positional arguments:**

* `inFile`\
  Tracking data file: records in CSV format holding air traffic data in [RealTraffic's AITraffic format](https://twinfan.gitbook.io/livetraffic/setup/installation/realtraffic-connectivity#technical-details) and weather data. `<stdin>` by default

**optional arguments:**

* `-h, --help`\
  show this help message and exit
* `-a HEX_LIST, --aircraft HEX_LIST`\
  List of aircraft to read and send, others skipped. Add one or several transponder hex id codes, separate by comma.
* `-d NUM_LIST, --aircraftDecimal NUM_LIST`\
  Same as `-a`, but specify decimal values (as used in the CSV file).
* `-b NUM, --bufPeriod NUM`\
  Buffering period: Number of seconds the first record is pushed into the past so that LiveTraffic's buffer fills more quickly. Recommended to be slightly less than *half of* LiveTraffic's [buffering period](https://twinfan.gitbook.io/livetraffic/setup/configuration/settings-advanced#aircraft-selection). (More than half of buf period triggers historic data processing.
* `--historic NUM`\
  Send historic data, ie. reduce included timestamp by this many seconds
* `-l, --loop`\
  Endless loop: restart from the beginning when reaching end of file. Will work best if data contains loop with last position(s) being roughly equal to first position(s).
* `--host NAME_OR_IP`\
  UDP target host or ip to send the data to, defaults to `localhost`
* `--port NUM`\
  UDPport to send traffic data to, defaults to `49005`
* `--weatherPort NUM`\
  UDP port to send weather data to, defaults to `49004`
* `-v, --verbose`\
  Verbose output: Informs of each sent record
