Skip to content

Instantly share code, notes, and snippets.

@yosiasz
Last active December 15, 2023 15:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosiasz/43439281ba49ad43aca10b2c8626de50 to your computer and use it in GitHub Desktop.
Save yosiasz/43439281ba49ad43aca10b2c8626de50 to your computer and use it in GitHub Desktop.
abyssinia
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
svg { width:100%; height: 100% }
</style>
</head>
<body>
<script>
var width = 960,
height = 500;
var path = d3.geo.path();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("ethiopia.json", function(error, topology) {
if (error) throw error;
console.log(topology);
svg.selectAll("path")
.data(topojson.feature(topology, topology.objects.regions).features)
.enter().append("path")
.attr("d", path);
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment