A demo of TopoJSON on a U.S. counties shapefile from the U.S. census bureau.
-
-
Save mbostock/4090870 to your computer and use it in GitHub Desktop.
U.S. Counties TopoJSON Mesh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
height: 600 | |
border: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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", 0.25) | |
.attr("stroke-linejoin", "round") | |
.attr("d", path(mesh)); | |
svg.selectAll("circle") | |
.data(us.arcs) | |
.enter().append("circle") | |
.attr("transform", function(d) { return "translate(" + transform(d[0]) + ")"; }) | |
.attr("r", 1.25); | |
}); | |
</script> |
d3.json("/mbostock/raw/4090846/us.json", function(error, us)
what this line indicate?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I noticed a ton of examples are no longer working, this one included. Any plans to fix?