Skip to content

Instantly share code, notes, and snippets.

@smokbel
Created March 14, 2018 14:10
Show Gist options
  • Select an option

  • Save smokbel/df13fef8fa8c892e554c2a6347548155 to your computer and use it in GitHub Desktop.

Select an option

Save smokbel/df13fef8fa8c892e554c2a6347548155 to your computer and use it in GitHub Desktop.
Topojson Map of ontario
license: mit
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#area {
stroke: black;
stroke-width: 1px;
fill: lightBlue;
}
</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([-11.5, 5.90])
.scale(750)
.translate([(width) / 2, (height)/2]);
var path = d3.geo.path()
.projection(null);
d3.json("qc-map.json", function(error, ont) {
console.log(ont)
svg.append("path")
.datum(topojson.feature(ont, ont.objects.CensusSubDivision))
.attr("id", "area")
.attr("d", path);
});
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Loading
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