Skip to content

Instantly share code, notes, and snippets.

@mbostock
Forked from mbostock/.block
Last active August 29, 2018 17:37
Show Gist options
  • Save mbostock/2869946 to your computer and use it in GitHub Desktop.
Save mbostock/2869946 to your computer and use it in GitHub Desktop.
Albers USA Projection
license: gpl-3.0
<!DOCTYPE html>
<meta charset="utf-8">
<title>Albers Projection</title>
<style>
path {
fill: #ccc;
stroke: #fff;
stroke-linejoin: round;
}
</style>
<svg width="960" height="500"></svg>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>
d3.json("/mbostock/raw/4090846/us.json", function(error, us) {
if (error) throw error;
d3.select("svg").append("path")
.datum(topojson.feature(us, us.objects.states))
.attr("d", d3.geo.path());
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment