Visualize airplane routes on a map

Hello everybody! First at all, I am a total beginner with programming. I am a visual designer and I'm trying to use Processing to visualize data.

I followed this great Skillshare class that shows how to visualize a meteorite strikes data set on a map.

I managed to have that done, and now I want to take it a step forward. I found on this website two data sets.

The first one shows all the airports in the world, with their latitude and longitude. I managed to visualize this on a map.

The second data set shows all the routes from airport to airport.

I would like to visualize the routes on the same map. The problem is that I don't know how to connect the two data sets in Processing. The connecting information is the code of the airport, which is present in both data sets.

Any suggestion?

Thanks, Dario.


  • you can read airports and routes data and simply match them ... get the "from airport" and "to airport" airport code from the routes dataset and iterate over the airports data and when you match the string get the long/lat values....

    how did you read the airports dataset?

  • edited April 2016

    Yes, that's what I was thinking about, the thing is that I'm a total noob and I'm kind of stuck on how to do it.

    This is what I've done so far, which gave me the airports on the map.

    // libraries
    import processing.pdf.*;
    // global variables
    PShape basemap;
    PFont f;
    String csv[];
    String myData[][];
    // setup
    void setup() {
      size(2000, 1000);
      noLoop(); //does everything only once
      //f = createFont("Helvetica-Medium", 12);
      basemap = loadShape("WorldMap.svg");
      csv = loadStrings("airports.csv");
      myData = new String[csv.length][12];
      for (int i=0; i<csv.length; i++) {
        myData[i] = csv[i].split(",");
    // draw
    void draw() {
      beginRecord(PDF, "airports.pdf");
      shape(basemap, 0, 0, width, height);
    // goes through the database "airports.csv", finds the coordinates of the airports and visualizes them on the map
      for (int i=0; i<myData.length; i++) {
        float graphLat = map(float(myData[i][6]), 90, -90, 0, height);
        float graphLong = map(float(myData[i][7]), -180, 180, 0, width);
        //float magnitude = sqrt(float(myData[i][4]))/PI;
        ellipse(graphLong, graphLat, 3, 3);
        fill(255, 0, 0, 100);
    println("PDF Saved");
  • edit post, highlight code, press ctrl-o

Sign In or Register to comment.