title: d3.js plot airport map points on map with coordinates on different file
body: <p>I want to plot US airports on a map in d3.js</p>
  
  <p>The source file is a csv one, which has only the airport codes, such as LAX or JFK.
  The coordinates are located in a different json file.
  I am using the function <strong>plot_airports</strong> and my issue is how to join the airport codes with the coordinates into the data variable.</p>
  
  <pre><code>function plot_airports(data) {
          svg.append('g')
             .attr("class", "airports")
             .selectAll("circle")
             .data(data)
             .enter()
             .append("circle")
             .attr('cx', function(d) {return projection([d.lon,d.lat])[0]; })
             .attr('cy', function(d) {return projection([d.lon,d.lat])[1]; })
             .attr('r', 5)
  </code></pre>
  
  <p>The function to read the airport code is the following:</p>
  
  <pre><code>d3.csv("sample.csv",function(d) {
      return d["airport"];
      });
  </code></pre>
  
  <p>and the one with the airports:</p>
  
  <pre><code>d3.json("airports.json"); 
  </code></pre>
  
  <p>I tried to save the result of each function into variables and then join them with the airport code as key but the resulting variables were empty. </p>
  
  <p>Thank you for your help!</p>