Flight path visualizations from ADSB data


#1

Anyone make any interesting visualizations or graphics from their receiver data?

I logged a day’s worth of flights for my local airport KAUS (only from aircraft that broadcast positions–no MLAT) and plotted them in Google Earth:


(click for larger version)

Google Earth can also animate GPS tracks, so I wrote the flight data in that kml track format, and for fun I timeshifted them so they all arrive and depart at the same time to make this animation: (http://i.imgur.com/U5GKJ77.gifv)


#2

Very nice! :slight_smile: Looks like you are only a mile or so away from me.


#3

the still picture looks like fallen reed at the edge of a lake - and the animation looks supercool :slight_smile: almost arts!


#4

SWEET! what kind of DB and scripting did you use to generate the KML file?

Cheers!
LitterBug


#5

Thanks, it is a small python script which reads a log of port 30003 messages. I should clean it up and put it on github.

The Google Earth KML is basically series of lon/lat/altitide datapoints (and times if you want gps track animation), so it’s pretty straightforward to create from the ads-b messages if you group the data by plane.

Hi neighbor! You are certainly the one to beat on my stats page of nearby sites :slight_smile:


#6

Flag ! :open_mouth:


#7

how can i do that???

[quote=“BartJr”]
Anyone make any interesting visualizations or graphics from their receiver data?

I logged a day’s worth of flights for my local airport KAUS (only from aircraft that broadcast positions–no MLAT) and plotted them in Google Earth:


(click for larger version)

Google Earth can also animate GPS tracks, so I wrote the flight data in that kml track format, and for fun I timeshifted them so they all arrive and depart at the same time to make this animation: *(http://i.imgur.com/U5GKJ77.gifv)
*[/quote]


#8

Thanks, it is a small python script which reads a log of port 30003 messages. I should clean it up and put it on github.

Please!


#9

+1,
I’m highly interested in that script too


#10

Awesome!


#11

Great Idea!.. Love it.


#12

+1 on sharing the code :smiley:


#13

Comparing MLAT (blue) vs ADSB (red) positions logged over 8 hours today. 1 dot = 1 position. Black circle = me.

I thought it was interesting that to the north and west, where I am blocked by hills, MLAT reception looks better than ADSB. I guess that makes sense, it should be harder to receive complete position messages than other shorter Mode-S messages used for mlat.

ADSB is clearly dominant east of Houston–probably beyond my mlat sync region.

(click for larger image)

I lost that script and have to rewrite it. The lesson is don’t store important things in /tmp :unamused:


#14

That area is also lots of longhaul aircraft to/from South America as well as Gulf of Mexico operations that have ADS-B.


#15

How about sharing the script you used for this map? I’d love to do a similar thing with the position log I kept for the last 24 hours.


#16

It’s basically just a scatterplot. I logged positions from the BaseStation-format output of dump1090 and mlat-client, but you could get data from aircraft.json as well. Here’s how I did it:



#add basestation output to mlat-client
sudo piaware-config -mlatResultsFormat "beast,connect,localhost:30104 basestation,listen,30303"
sudo service piaware restart
#start logging
nc -d localhost 30303 | cut -d , -f 15,16 > MLAT.latlon&
nc -d localhost 30003 | egrep 'MSG,[23]' | cut -d , -f 15,16 > ADSB.latlon&


Then make a plot with your favorite program. I used gnuplot and mercator projection:



gnuplot> set datafile separator comma
gnuplot> set angle degrees
gnuplot> mercator(lat) = log(tan(45 + lat/2))*180/pi
gnuplot> plot 'ADSB.latlon' u 2:(mercator($1)) w dots lc 'red', 'MLAT.latlon' u 2:(mercator($1)) w dots lc 'blue', 'texas.csv' u 1:(mercator($2)) w lines lw 2

The state outline coordinates are in texas.csv, which I made by grabbing lat/lon data out of this svg.

Since there are a lot of overlapping points, a heatmap would probably be more interesting than just a scatter. I will have to try that in matplotlib or something.

edit: Actually my gnuplot script was a little more complicated… Because so many points overlap, if you draw MLAT second the dots are drawn on top of many ADSB dots so it will look like you have more MLAT than reality (or vice versa). To work around this I added a third column of 0 or 1, combined the two into one file, and randomized the line order. This way MLAT and ADSB dots are drawn randomly so it looks better when there is a tight grouping.



% cat logADSB | awk 'BEGIN{OFS=",";FS=","}{print $16,$15,0}' > foo2
% cat logMLAT | awk 'BEGIN{OFS=",";FS=","}{print $16,$15,1}' > foo1
% cat foo1 foo2 | shuf > combined
gnuplot> set cbrange [0:1]
gnuplot> set palette defined (0 'red', 1 'blue')
gnuplot> plot 'combined' u 1:(mercator($2)):3 w dots palette



#17

What kind of antenna are you using? You seem to be getting a lot more range than I am (I’m at about 730 ft elevation near Northcross Mall).


#18

Ahh, awesome. Wasn’t sure if you were using gnuplot, matplotlib, or something else.

Since this was so intriguing, I decided to pursue a matplotlib solution today and write a script. Here it is, super-hardcoded at the moment, but it works! I would definitely recommend running this not on your Pi as it has to crunch for a while. I also fed it upwards of 1.3 million positions logged over the last 20 hours. I can clean this up and get it on github at some point.



from mpl_toolkits.basemap import Basemap
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

def main():
    lats = ]
    lons = ]
    alts = ]

    print('processing data...')
    with open('testdata.csv', 'r') as data:
        for line in data:
            pieces = line.split(',')
            if pieces[1] == '3':
                lats.append(float(pieces[14]))
                lons.append(float(pieces[15]))
                alts.append(int(pieces[11]))

    print('drawing map...')
    plt.figure(figsize=(80, 60))
    my_map = Basemap(llcrnrlon=min(lons), llcrnrlat=min(lats),
                     urcrnrlon=max(lons), urcrnrlat=max(lats),
                     resolution='h')
    #my_map.drawmapboundary()
    my_map.drawcoastlines()
    my_map.drawstates()
    my_map.drawrivers()
    my_map.fillcontinents(color='0.975', zorder=0)

    print('plotting points...')
    x, y = my_map(lons, lats)
    my_map.scatter(x, y, s=1.0, c=alts, marker='o', lw=0, cmap='plasma')
    plt.savefig('/tmp/my_map.png', bbox_inches='tight', pad_inches=0)


if __name__ == '__main__':
    main()


Here is the result. Colors are based on altitude of the recorded position. You should be able to make your own if you provide it a file with BaseStation format data captured off port 30003 or similar.

Large Image


#19

Nice! The streaking or starburst pattern of your reception is very interesting. Do you know the cause of that?

I actually haven’t used matplotlib before so I will work off your example :smiley:

I have two setups in the attic at the moment: a Moonraker 6.5dBd collinear (should be comparable to the FlightAware antenna) and a 900MHz cellular Yagi (which actually works pretty well at 1090) pointed at Houston. The graphic above is from the Yagi. Of course it helps that I am at 100ft higher elevation and I have a clear view to the east.


#20

Thanks. I just moved my rig up higher in the attic. I actually had it inside a 2nd floor room for the last year or two (or however long I’ve been running it). Since I got the new pro receiver, I decided to move it to the attic. Yesterday I moved it to where I could reach, which wasn’t much higher than inside. Today, after moving ladders, installing a hook, routing an extension coord, etc., I mounted it at the peak of my attic, which is about 28 feet above ground. I figure the antenna is a foot or two lower than this.

I have a weather station with anemometer on a mast outside that’s at 40’ above ground. I’ll be moving my receiver up there after I figure out how to weatherproof it. Also, I didn’t really want to route A/C current up the mast, so I may figure out an alternative for that, too.

Anyway, after I moved the device to the peak of the attic, I started getting some flights recorded over 200 miles away. I’ll have to watch for a while to see where the farthest signals are coming from. Used to be Abilene, but now I’m starting to see activity in the gulf, Dallas, Houston, Laredo, and Del Rio. I’ll be curious to see what it looks like after a few days. Looks like I’m barely seeing into Mexico. :slight_smile: