Skip to content

Instantly share code, notes, and snippets.

@phil-pedruco
Created September 26, 2013 05:42
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 phil-pedruco/6710250 to your computer and use it in GitHub Desktop.
Save phil-pedruco/6710250 to your computer and use it in GitHub Desktop.
Topojson Map of Qubec
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#area {
stroke: grey;
stroke-width: 1px;
fill: steelblue;
}
</style>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<body>
<script>
var width = 960,
height = 500;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var projection = d3.geo.mercator()
.center([-71.94, 52.90])
.scale(750)
.translate([(width) / 2, (height)/2]);
var path = d3.geo.path()
.projection(projection);
d3.json("qc-map.json", function(error, qbec) {
console.log(qbec)
svg.append("path")
.datum(topojson.feature(qbec, qbec.objects.map_qc))
.attr("id", "area")
.attr("d", path);
});
</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