Built with blockbuilder.org
Last active
December 15, 2023 15:46
-
-
Save yosiasz/43439281ba49ad43aca10b2c8626de50 to your computer and use it in GitHub Desktop.
abyssinia
This file contains hidden or 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> | |
<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