let d3 = require('d3'),
topojson = require('topojson'),
projection = d3.geoAlbersUsa(),
path = d3.geoPath().projection(projection),
topohref = "https://gist.githubusercontent.com/mbostock/4090846/raw/d534aba169207548a8a3d670c9c2cc719ff05c47/us.json",
airportshref = "http://bl.ocks.org/mbostock/raw/4408297/airports.json",
topo,
airports;
undefined
d3.json(topohref, (err, data) => (topo = data, console.log(err || data ? "OK" : "error")));
"loading topojson… "
'loading topojson… '
OK
d3.json(airportshref, (err, data) => (airports = data, console.log(err || data ? "OK" : "error")));
"loading airports… "
'loading airports… '
OK
svg1 = '<svg width=960 height=500>'
+ '<path fill="#ddd" d="'
+ path(topojson.feature(topo, topo.objects.land))
+ '"/>';
$$.svg(svg1);
svg2 = svg1
+ '<path fill="none" stroke="white" d="'
+ path(topojson.mesh(topo, topo.objects.states), function(a, b) { return a !== b; })
+ '"/>';
$$.svg(svg2);
path.pointRadius(1.5);
svg3 = svg2
+ '<path d="'
+ path(topojson.feature(airports, airports.objects.airports))
+ '"/>';
$$.svg(svg3);