Skip to content

Instantly share code, notes, and snippets.

@Andrew-Reid
Created June 16, 2020 00:37
Show Gist options
  • Save Andrew-Reid/8c9b087b39925ededaae268c856be977 to your computer and use it in GitHub Desktop.
Save Andrew-Reid/8c9b087b39925ededaae268c856be977 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
/* CSS goes here. */
</style>
<body>
<script src="//d3js.org/d3.v4.min.js" charset="utf-8"></script></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>
var width = 960,
height = 1160;
var identity = d3.geoIdentity()
var path = d3.geoPath(identity)
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("topojson.json", function(error, uk) {
var geojson = topojson.feature(uk, uk.objects.test)
identity.fitSize([width,height],geojson)
svg.append("path")
.datum(geojson)
.attr("d", path)
.attr("fill","none")
.attr("stroke","black")
.attr("stroke-width",1);
});
</script>
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