Adding aircraft routes to Tar1090

Ben Gallagher

ads-baviationtar1090

400 Words min read1 Minute, 49 Seconds

2025-02-03 11:20


Adding route information to TAR1090

I want to add routes to my tar1090.

Checking the config in \usr\local\share\tar1090\html\config.json I can see the following section: tar1090 route config However, no route info is showing in the frontend gui…

After some further testing, I realised that it was my side, and a cache problem (remember kids, Ctrl + F5 is your friend)! tar1090

Now, that was the easy bit…

Using ICAO codes rather than IATA codes.

First thing to note, I’m pretty sure that there is a cache somewhere server side. If you are testing, prepare for much anguish. It might also be CloudFlare’s cache the more I think about it…

From what I can tell, a couple lines need to be changed in planeObject.js within /usr/local/share/tar/html My planeObject.js had some further text after it, not sure what that’s about: ls of html

Within this file, locate the function routeDoLookup, and find the sections containing _airport_codes_iata. There’s 5 references to this, 3 are part of logging, and two we need. Update these to airport_codes - note the underscore at the start, this tripped me up first time.

                for (var route of routes) {
                    // let's log just a little bit of what's happening
                    if (debugRoute) {
                        var logText = `result for ${route.callsign}: `;
                        if (route.**airport_codes** == 'unknown') {
                            logText += 'unknown to the API server';
                        } else if (route.plausible == false) {
                            logText += `${route.**airport_codes**} considered implausible`;
                        } else {
                            logText += `adding ${route.**airport_codes**}`;
                        }
                        //console.log(logText);
                    }
                    if (route.airport_codes != 'unknown') {
                        if (route.plausible == true) {
                            g.route_cache[route.callsign] = route.**airport_codes**;
                        } else {
                            g.route_cache[route.callsign] = `?? ${route.**airport_codes**}`;
                        }

And that should be it. (don’t include the asterisk *) When the API request is sent, it’ll return with this:

[
  {
    "_airport_codes_iata": "STN-BCN",
    "_airports": [
      {
        "alt_feet": 348,
        "alt_meters": 106.07,
        "countryiso2": "GB",
        "iata": "STN",
        "icao": "EGSS",
        "lat": 51.884998,
        "location": "London",
        "lon": 0.235,
        "name": "London Stansted Airport"
      },
      {
        "alt_feet": 12,
        "alt_meters": 3.66,
        "countryiso2": "ES",
        "iata": "BCN",
        "icao": "LEBL",
        "lat": 41.2971,
        "location": "Barcelona",
        "lon": 2.07846,
        "name": "Barcelona International Airport"
      }
    ],
    "airline_code": "RYR",
    "airport_codes": "EGSS-LEBL",
    "callsign": "RYR82TK",
    "number": "82TK",
    "plausible": 1
  }
]

We want ‘airport_codes’ from this response.

Now, I think you’ll need to wait a period of time for a cache to expire (or in my case set site to developer mode in CloudFlare).

Once this is all done, you should now have routes in ICAO format and labels also showing in ICAO format! final results

Hope this has been useful!