Skip to content

Instantly share code, notes, and snippets.

@poezn
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poezn/48da59e57bc09314c534 to your computer and use it in GitHub Desktop.
Save poezn/48da59e57bc09314c534 to your computer and use it in GitHub Desktop.
Aligning topojson?
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.
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.
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<style>
</style>
<body>
<svg></svg>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://d3js.org/queue.v1.min.js"></script>
<script>
var cm = tributary.getCodeEditor("inlet.js")
cm.tabSize = 4;
var width = 980,
height = 800;
var path = d3.geo.path()
.projection(null);
var svg = d3.select("svg");
queue()
.defer(d3.json, "ca.json")
.defer(d3.json, "ag.json")
.await(ready);
function ready(error, ca, ag) {
svg.append("path")
.datum(topojson.feature(ca, ca.objects.ca))
.attr({
"class": "ca",
"d": path
});
svg.append("path")
.datum(topojson.feature(ag, ag.objects.agri))
.attr({
"class": "ag",
"d": path
}
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment