Skip to content

Instantly share code, notes, and snippets.

@kencrocken
Last active May 28, 2017 04:50
Show Gist options
  • Save kencrocken/57d9aa88a9c3f2a14c42f1cceda19728 to your computer and use it in GitHub Desktop.
Save kencrocken/57d9aa88a9c3f2a14c42f1cceda19728 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<svg width="960" height="600"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://d3js.org/topojson.v2.min.js"></script>
<script>
var svg = d3.select("svg");
d3.json("https://d3js.org/us-10m.v1.json", function(error, us) {
if (error) throw error;
var path = d3.geoPath(),
mesh = topojson.mesh(us),
transform = topojson.transform(us);
svg.append("path")
.attr("fill", "none")
.attr("stroke", "#000")
.attr("stroke-width", 1)
.attr("d", path(mesh));
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment