Skip to content

Instantly share code, notes, and snippets.

@e9t

e9t/README.md Secret

Last active December 16, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save e9t/5409518 to your computer and use it in GitHub Desktop.
Save e9t/5409518 to your computer and use it in GitHub Desktop.
South Korea Municipalities

Description

  • Level: Municipalities (시군구)
  • Data format: TopoJSON
  • Data source: GADM

The data download script can be found here.

Author

Lucy Park, Team POPONG

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
svg {
background-color: lightskyblue;
}
.municipality {
fill: #eee;
stroke: #999;
}
.municipality:hover {
fill: orange;
}
</style>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
<script>
var w = 960, h = 500;
var proj = d3.geo.mercator()
.center([128.0, 35.9])
.scale(4000)
.translate([w/2, h/2]);
var path = d3.geo.path().projection(proj);
var svg = d3.select("body").append("svg")
.attr("width", w)
.attr("height", h);
d3.json("skorea-municipalities-topo.json", function(error, kor) {
var municipalities = topojson.object(kor, kor.objects['skorea-municipalities-geo']);
svg.selectAll('path').data(municipalities.geometries)
.enter().append('path')
.attr('d', path)
.attr('class', 'municipality');
});
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment