Skip to content

Instantly share code, notes, and snippets.

@Andrew-Reid
Created April 10, 2018 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrew-Reid/bbfcf7d013020e9c1f19eac58e2beef4 to your computer and use it in GitHub Desktop.
Save Andrew-Reid/bbfcf7d013020e9c1f19eac58e2beef4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<svg width="960" height="600" fill="none" stroke="#000" stroke-linejoin="round" stroke-linecap="round"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script>
var svg = d3.select("svg");
var path = d3.geoPath();
d3.json("projected.topojson", function(projected) {
d3.json("unprojected.topojson", function(unprojected) {
svg.append("path")
.attr("d", path(topojson.feature(projected, projected.objects.nation)));
var projection = d3.geoAlbersUsa();
var scale = projection.scale() * 6 / 5;
projection.scale(scale).translate([960/2,600/2])
var projectedPath = d3.geoPath().projection(projection);
svg.append("path")
.attr("d", projectedPath(topojson.feature(unprojected, unprojected.objects.nation)));
});
});
</script>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{"type":"Topology","arcs":[[[8156,13570],[38,38],[-4,35],[68,9],[61,-16],[84,-45],[62,-21],[-11,-51],[35,-130],[-6,-80],[43,-188],[-1,-150],[-33,-7],[-60,121],[-82,81],[38,61],[-99,68],[-4,63],[-67,73],[-25,70],[-39,32],[2,37]],[[4669,13344],[50,71],[62,30],[39,-3],[11,53],[105,41],[-6,42],[102,115],[47,24],[4,44],[51,13],[-31,-72],[24,-22],[50,12],[59,-45],[-8,-32],[-128,-25],[-45,-22],[-8,-44],[74,17],[-4,-76],[54,-45],[-32,-42],[-47,-6],[-24,-57],[-47,-8],[8,-43],[-123,-82],[-57,-22],[-34,-45],[-98,105],[-12,87],[-36,37]],[[4658,13024],[62,62],[80,4],[15,-45],[-98,6],[-59,-27]],[[4426,631],[43,83],[-12,78],[29,-11],[27,-33],[62,-37],[36,-54],[21,-75],[31,-35],[-12,-33],[-54,-56],[-20,2],[-47,-46],[-20,-57],[-22,0],[-36,44],[5,84],[-31,146]],[[4302,1017],[15,36],[27,-44],[45,14],[35,-43],[11,-38],[-24,-24],[-58,-10],[-8,65],[-30,10],[-13,34]],[[4233,1015],[23,4],[25,-36],[-30,-29],[-18,61]],[[4009,1241],[20,1],[30,43],[25,-62],[22,-24],[4,-66],[-36,14],[-41,-2],[-25,64],[1,32]],[[3712,1404],[38,54],[35,3],[20,-37],[-8,-58],[-21,-28],[-30,8],[-29,29],[-5,29]],[[3622,12514],[22,87],[51,39],[10,-37],[63,4],[55,-93],[-21,-16],[-37,55],[-48,13],[-52,-16],[-43,-36]],[[3506,12651],[33,28],[32,-7],[49,28],[21,-29],[-72,-41],[-56,-47],[-7,68]],[[3126,12378],[95,-37],[-23,-20],[-56,10],[-16,47]],[[2510,12268],[83,38],[47,-34],[-32,-29],[-95,-23],[-3,48]],[[2248,14301],[114,24],[88,29],[43,28],[22,-40],[68,-9],[-6,-76],[25,-54],[-97,-23],[-53,0],[-83,25],[-103,52],[-18,44]],[[2179,11980],[98,49],[52,93],[-26,25],[21,40],[74,23],[26,-31],[79,-32],[-8,-33],[-58,-30],[-59,-68],[-80,-10],[-87,-54],[-32,28]],[[2114,16147],[29,25],[133,57],[98,58],[261,119],[193,54],[152,-8],[-51,-57],[-9,-67],[43,-44],[181,10],[80,-20],[94,-3],[68,81],[-132,144],[-63,19],[-25,86],[-204,38],[-34,104],[-33,50],[-249,156],[-120,39],[-21,27],[-98,38],[52,37],[26,96],[-6,49],[134,-5],[243,25],[130,65],[63,62],[18,104],[31,71],[131,129],[81,42],[114,-11],[91,27],[114,62],[108,79],[206,0],[104,13],[117,49],[117,105],[53,3],[181,-42],[14,-78],[87,69],[91,-47],[2,-61],[85,-16],[46,36],[124,13],[156,-22],[45,-21],[-47,-61],[141,-23],[-8,-38],[108,-20],[119,35],[49,-21],[83,31],[77,3],[152,-30],[61,-42],[93,-4],[19,-25],[116,-22],[125,10],[96,-15],[159,-50],[96,-9],[145,51],[121,12],[103,-37],[65,-43],[132,-43],[54,-32],[82,-16],[0,-388],[0,-900],[1,-1331],[0,-540],[89,-28],[12,29],[92,-42],[56,53],[117,5],[-22,-90],[30,-31],[66,-30],[22,-53],[188,-173],[30,-112],[119,84],[47,2],[22,40],[-2,61],[24,46],[77,22],[90,46],[86,-80],[-8,-48],[21,-48],[49,-11],[43,-41],[44,-91],[78,-44],[88,-101],[-15,-15],[54,-79],[119,-219],[58,-97],[-22,-41],[61,-15],[-15,-60],[49,-23],[7,-69],[49,4],[95,-70],[52,-12],[66,-44],[8,-34],[62,-8],[19,-42],[-23,-63],[0,-82],[23,-101],[-65,-116],[-56,-49],[-57,10],[-12,80],[-64,-62],[-56,29],[3,55],[-27,7],[-22,54],[3,57],[-64,44],[-19,114],[-41,48],[-41,15],[-2,36],[-67,38],[18,37],[66,8],[34,34],[-20,66],[-45,33],[-28,65],[-74,22],[-42,44],[14,42],[-9,55],[-63,137],[-57,89],[-93,17],[-23,48],[-68,20],[4,-84],[-62,48],[-61,18],[-60,-5],[-76,-27],[-29,-28],[-187,125],[-72,70],[-2,31],[-52,49],[-79,33],[-54,40],[-96,45],[-84,56],[53,33],[-5,60],[-32,4],[-89,-49],[-105,14],[-115,47],[-39,31],[-220,45],[-168,-19],[-53,-17],[-40,38],[-46,-3],[-59,39],[-52,8],[-31,31],[-55,11],[-50,-18],[-67,29],[-77,-20],[-41,-29],[-60,17],[-65,-62],[-48,-90],[-66,10],[-20,30],[-100,-8],[-123,11],[-73,-67],[-79,-27],[-98,-118],[-75,-4],[-58,-41],[-103,-41],[-37,19],[-25,45],[19,49],[107,51],[-60,25],[-44,41],[29,82],[57,68],[27,96],[-25,73],[67,26],[126,84],[40,-46],[40,-7],[51,44],[-66,48],[-27,36],[-91,3],[-50,-19],[-43,-56],[-60,-12],[-61,-53],[-19,-45],[-83,-83],[-15,-63],[-25,-16],[-7,-65],[-24,-44],[-51,-13],[-16,-64],[-94,-21],[-30,-56],[-57,-27],[-35,-88],[22,-17],[71,0],[82,-70],[-62,-77],[-50,-9],[-71,-162],[-69,-39],[-56,3],[-47,-25],[-45,-80],[-48,21],[-24,-77],[-60,-8],[-61,-43],[6,-74],[-42,-66],[-187,-79],[6,-46],[-80,9],[19,-44],[-90,-11],[-39,-47],[71,-37],[-49,-33],[-11,-47],[-127,-27],[2,-27],[-85,-54],[-61,43],[-34,-4],[-20,-37],[-50,-27],[-25,-43],[-87,-1],[-53,-39],[-44,1],[18,91],[-38,-3],[-19,-72],[-51,-100],[-51,-28],[-3,-50],[-37,5],[3,48],[-80,-37],[-25,22],[-56,-52],[36,-43],[-97,-30],[-89,0],[-42,-17],[-18,-37],[-55,-25],[-42,14],[-17,50],[40,22],[31,61],[154,78],[94,-8],[-6,32],[79,43],[49,47],[81,108],[79,61],[125,41],[67,4],[41,-14],[39,100],[107,89],[56,28],[108,73],[60,-11],[-4,61],[69,99],[45,26],[29,40],[48,29],[-5,32],[43,279],[80,87],[-10,43],[-196,-85],[-45,45],[-75,39],[-18,-57],[30,-72],[-34,-31],[-35,11],[-66,119],[-58,52],[-15,-35],[-69,14],[-33,30],[-78,-12],[-116,-60],[-7,-26],[-72,-38],[-14,61],[4,87],[-47,89],[66,80],[-100,191],[-51,25],[-4,-52],[-181,-56],[-90,-2],[-39,14],[0,49],[-53,36],[-55,68],[-55,18],[-72,53],[-1,25],[72,40],[-18,72],[5,50],[-111,26],[3,48],[-57,42],[33,29],[-89,40],[23,70],[87,11],[-20,39],[13,60],[136,175],[68,154],[32,31],[72,20],[64,-17],[79,-59],[51,7],[101,87],[33,47],[-68,41],[59,20],[80,-64],[151,15],[78,89],[-34,158],[-58,60],[13,33],[77,42],[2,33],[-67,61],[-46,-42],[-52,1],[-104,-35],[-67,-48],[-61,-11],[-53,-40],[-53,49],[-52,15],[-119,-3],[-96,-38],[-93,11],[-181,35],[-47,58],[10,43],[-92,82],[83,14],[8,51],[-198,32],[-110,53],[-16,29]],[[1893,11794],[96,88],[4,47],[34,35],[27,-7],[19,71],[61,29],[45,-15],[-10,-44],[-87,-54],[-31,-58],[-57,-50],[-101,-42]],[[1723,11794],[15,46],[45,-4],[30,-45],[-90,3]],[[1404,15440],[7,51],[163,-49],[116,42],[48,-28],[17,-46],[104,-39],[149,-22],[-30,-48],[-75,7],[-58,-34],[-6,-33],[-92,63],[-41,6],[-32,45],[-89,35],[-64,-7],[-39,-30],[-63,25],[-15,62]],[[1168,14473],[43,-64],[58,-35],[-16,-26],[-83,56],[-2,69]],[[741,11547],[113,25],[48,29],[1,34],[52,35],[38,-34],[-7,-62],[94,9],[4,-46],[-147,22],[-25,-26],[-175,-2],[4,16]],[[426,11423],[26,81],[45,26],[0,-55],[77,14],[-7,61],[30,16],[51,-65],[-40,-40],[-90,-25],[-47,-36],[-45,23]],[[288,11442],[84,20],[24,-28],[-105,-23],[-3,31]],[[187,11497],[59,-19],[52,2],[-48,-60],[-63,77]],[[68481,11412],[63,-11],[70,-69],[-8,-28],[-73,75],[-52,33]],[[67493,11688],[64,13],[-23,-52],[-41,39]],[[67306,11851],[35,18],[92,-5],[58,-42],[-100,-36],[-29,39],[-56,26]],[[21425,156],[22,46],[75,-13],[21,7],[138,-14],[61,-20],[-3,-61],[-30,-19],[-14,-45],[-40,-30],[-39,-7],[-18,21],[-47,-5],[-34,12],[-32,-24],[-54,23],[10,75],[-16,54]],[[20737,7928],[44,43],[30,-43],[-74,0]],[[18636,2251],[12,29],[59,54],[38,-48],[-85,-39],[-24,4]],[[17891,9410],[34,32],[32,-4],[-29,-75],[-37,47]],[[17218,10145],[113,81],[10,-36],[-53,-26],[-58,-48],[-12,29]],[[11343,5460],[105,-2],[-5,-19],[-63,-12],[-37,33]],[[11256,5467],[60,-14],[-13,-48],[-46,33],[-1,29]],[[10707,10407],[57,36],[37,-43],[-25,-83],[-51,30],[-18,60]],[[10422,10306],[14,2],[115,-72],[200,-30],[47,18],[23,151],[-22,140],[192,-2],[335,1],[223,0],[346,0],[349,0],[290,-1],[419,0],[255,1],[224,0],[298,0],[267,0],[224,0],[288,0],[221,-1],[209,1],[232,0],[200,0],[371,0],[340,0],[0,130],[65,-21],[25,-148],[-2,-32],[48,-33],[115,-21],[6,-35],[66,6],[50,33],[48,-4],[84,-62],[28,-77],[21,46],[39,1],[15,-37],[51,-17],[33,-49],[55,10],[78,54],[27,-50],[109,6],[51,-42],[-20,-54],[-108,-43],[-63,-49],[-113,-141],[-116,-114],[9,-33],[37,-5],[125,52],[47,53],[34,-36],[-26,-52],[24,-32],[61,-29],[75,36],[41,46],[80,14],[52,47],[35,8],[13,32],[59,47],[31,44],[39,26],[55,10],[-3,-48],[-48,-43],[-50,-96],[16,-18],[44,32],[47,-19],[58,-43],[44,-93],[74,6],[32,-26],[22,36],[27,-23],[80,63],[126,2],[43,25],[43,-26],[12,-68],[163,14],[0,-116],[45,-44],[54,16],[14,-58],[-106,17],[-57,-13],[-49,7],[-31,-31],[-68,64],[-75,10],[-30,-40],[-41,-14],[-30,16],[-40,-8],[-50,-79],[-45,35],[-36,-47],[-40,-4],[-34,-86],[-38,-73],[-16,-73],[-35,-7],[-32,-80],[40,-27],[37,72],[26,12],[34,66],[39,-1],[-74,-167],[-18,-89],[7,-38],[-28,-43],[-16,-71],[6,-66],[-35,-125],[-1,-99],[24,-78],[-9,-48],[-4,-116],[29,-76],[31,-124],[50,-30],[84,47],[43,54],[46,113],[22,97],[7,75],[-9,109],[-30,86],[-25,104],[21,66],[-16,74],[47,97],[9,75],[-5,44],[30,15],[6,57],[53,23],[29,65],[21,-67],[27,25],[2,76],[63,56],[-15,45],[48,61],[29,9],[49,-42],[51,-11],[19,-42],[36,-4],[100,-71],[23,-84],[-11,-49],[9,-65],[-12,-121],[-36,-24],[-11,-69],[-55,-32],[-15,-77],[51,-49],[33,49],[20,63],[91,50],[26,-15],[31,-65],[21,-205],[20,-74],[-18,-125],[-32,-39],[-34,7],[-13,-65],[-33,-20],[-7,-69],[-59,-94],[22,-37],[75,-63],[19,25],[42,-54],[30,-14],[89,43],[49,-9],[87,92],[183,94],[134,97],[94,81],[17,43],[38,34],[-11,48],[-32,49],[1,62],[100,37],[77,2],[74,-12],[40,-36],[40,16],[74,-4],[51,28],[52,57],[34,3],[2,93],[-35,41],[24,94],[64,49],[35,56],[98,116],[81,53],[115,-8],[226,8],[134,-3],[163,3],[18,62],[43,15],[32,35],[32,-38],[12,67],[44,80],[56,75],[-10,24],[4,76],[16,49],[30,33],[11,90],[148,258],[35,-12],[0,-60],[26,-22],[57,24],[47,36],[30,-6],[79,-92],[2,-382],[-5,-88],[52,-28],[22,-31],[-12,-79],[71,-53],[31,-100],[-66,-73],[-30,0],[-77,-61],[-52,-11],[-60,-92],[-122,-48],[-47,-40],[-114,-27],[-48,-34],[-48,-106],[-26,-13],[-8,-54],[-39,-81],[-1,-48],[29,-68],[-62,-76],[47,-49],[18,-44],[-5,-41],[23,-49],[52,-32],[64,30],[-13,-47],[-61,-14],[-79,-48],[-33,30],[-54,-40],[-45,-1],[-25,-28],[-190,-41],[-74,3],[-93,-72],[6,-31],[31,-17],[23,23],[100,8],[44,49],[14,-25],[66,-21],[-206,-110],[-94,-29],[-52,-1],[-31,-16],[-23,18],[-39,-32],[56,-52],[-25,-200],[-60,-134],[-44,-51],[-42,-91],[-4,68],[-48,13],[-59,75],[9,-117],[18,-49],[41,-39],[8,-117],[-28,-120],[-36,-83],[-33,-35],[-20,-100],[-31,-87],[-31,-32],[-8,64],[16,93],[23,77],[22,20],[-30,85],[-5,47],[-63,22],[-23,63],[3,63],[-8,88],[25,52],[-37,38],[-5,-89],[-20,-63],[7,-73],[24,-51],[0,-50],[-38,-9],[-52,19],[5,-36],[43,-5],[36,-58],[36,-30],[-17,-74],[15,-84],[-28,-67],[24,-47],[0,-41],[52,-14],[38,-214],[58,-190],[7,-44],[-14,-126],[-73,-36],[-43,-44],[-60,-93],[-16,-42],[-37,36],[-78,-21],[-95,-93],[-38,-66],[-25,-105],[-34,20],[-47,-3],[-55,-29],[-51,-60],[-38,-80],[-15,-84],[-28,-50],[-40,-27],[-57,-65],[-25,-44],[-65,-43],[-28,-6],[6,-45],[-27,-18],[-50,-59],[1,-38],[-54,-90],[0,-33],[-24,-74],[-9,-67],[-19,-28],[0,-73],[-11,-47],[13,-145],[26,-188],[56,-215],[73,-186],[11,-47],[-15,-42],[11,-97],[31,-105],[65,-297],[1,-99],[-13,-163],[0,-91],[-37,-69],[-11,-155],[-56,-98],[-37,-4],[63,82],[4,35],[-61,-4],[-51,-23],[-17,43],[4,55],[-27,90],[-18,34],[-44,40],[-22,5],[-22,142],[-15,37],[-50,13],[-16,95],[-52,168],[-29,62],[-3,64],[-27,77],[-2,108],[18,24],[20,102],[-14,103],[8,19],[-26,65],[-66,65],[-13,48],[-31,31],[-3,49],[-23,18],[-27,66],[-74,62],[-43,-15],[-53,-83],[-92,-76],[-41,32],[-18,-7],[-12,62],[6,26],[-118,118],[-42,25],[-79,18],[-131,-27],[-96,-30],[5,32],[-27,56],[1,56],[-25,-3],[-14,-110],[-44,23],[-21,-23],[-81,25],[-86,-34],[-19,-30],[-77,-63],[28,-49],[49,63],[50,1],[-10,-63],[-31,-36],[-1,-30],[-38,-24],[23,-69],[54,-21],[35,-60],[-25,-46],[-41,14],[-23,48],[-30,26],[-39,9],[-73,-79],[-42,-9],[-81,0],[-15,35],[-64,29],[-22,85],[-26,11],[-26,73],[-36,-15],[27,-45],[-21,-32],[-46,38],[-50,-19],[-69,25],[-94,56],[-108,-11],[-23,-20],[-38,-2],[-103,-69],[-24,-46],[-58,-62],[-68,-96],[-156,-123],[-47,-62],[-37,-32],[-48,-65],[-49,-106],[-30,-98],[-16,-125],[11,-121],[24,-134],[10,-113],[-37,-16],[-16,-28],[-42,56],[-29,17],[-77,0],[-47,48],[-41,13],[-29,45],[-58,19],[-30,141],[-34,62],[3,45],[-19,50],[8,36],[-13,68],[-29,14],[-27,42],[-16,63],[-28,54],[-37,42],[-24,110],[-20,29],[-24,82],[-9,66],[-74,122],[-38,21],[-27,73],[-109,24],[-20,-7],[-44,30],[-17,-37],[-55,-10],[-25,-73],[-12,-95],[-39,-52],[-10,-35],[-29,0],[-98,93],[-67,42],[-76,99],[-26,80],[-5,101],[-30,61],[-6,49],[-22,46],[-60,49],[-46,59],[-13,36],[-28,23],[-35,67],[-42,31],[-47,100],[-22,11],[-320,0],[-1,-152],[-310,0],[-238,-1],[-247,139],[-265,144],[-204,110],[18,76],[-142,-17],[-318,-45],[-30,103],[0,59],[-32,86],[-38,59],[-93,105],[-51,-6],[-3,50],[-20,49],[-55,-9],[-58,32],[-31,53],[-66,57],[-49,-4],[-52,22],[-59,-9],[-37,45],[7,94],[-12,15],[7,75],[-50,42],[2,61],[-23,11],[-31,59],[-20,10],[-78,169],[-40,47],[-16,94],[21,10],[14,69],[-22,52],[-39,-5],[-55,79],[-1,50],[-22,63],[1,84],[21,12],[8,-72],[36,-30],[1,55],[-28,37],[-4,45],[13,48],[-25,31],[-27,-106],[-77,68],[-13,90],[-31,60],[-31,31],[-21,45],[-52,72],[4,37],[-26,115],[12,65],[-17,94],[-45,84],[-53,61],[-9,60],[56,187],[-9,50],[20,102],[-18,98],[-17,21],[6,70],[-19,23],[-19,62],[0,138],[-27,62],[14,37],[19,108],[28,97],[16,120],[16,244],[-1,56],[19,117],[-1,117],[7,74],[-5,67],[18,112],[-40,10],[0,158],[-29,187],[-16,23],[-18,113],[-50,93],[-10,142]],[[8659,12855],[53,55],[1,82],[87,2],[60,-54],[9,-50],[70,-82],[41,-124],[54,-80],[4,-131],[-14,-31],[-53,6],[-19,22],[-88,-28],[-57,93],[-13,76],[-68,37],[-39,50],[28,92],[-11,37],[-45,28]],[[8572,13174],[96,79],[106,-32],[44,1],[39,-69],[54,-48],[-10,-40],[-71,-8],[-27,-22],[-90,-4],[-32,-17],[-27,-102],[-46,-19],[-18,102],[19,66],[-24,8],[-13,105]],[[8463,13694],[67,-78],[82,-32],[53,-91],[18,-67],[-33,-104],[-98,-92],[-27,27],[15,101],[-26,93],[-17,135],[-34,108]]],"transform":{"scale":[0.005224407618353969,0.0029566640265854325],"translate":[-179.174265,17.913769]},"objects":{"nation":{"type":"GeometryCollection","geometries":[{"arcs":[[[0]],[[1]],[[2]],[[3]],[[4]],[[5]],[[6]],[[7]],[[8]],[[9]],[[10]],[[11]],[[12]],[[13]],[[14]],[[15]],[[16]],[[17]],[[18]],[[19]],[[20]],[[21]],[[22]],[[23]],[[24]],[[25]],[[26]],[[27]],[[28]],[[29]],[[30]],[[31]],[[32]],[[33]],[[34]],[[35]],[[36]],[[37]]],"type":"MultiPolygon"}]}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment