Built with blockbuilder.org
forked from anonymous's block: MV grid district visualization
forked from anonymous's block: MV grid district visualization
license: mit |
Built with blockbuilder.org
forked from anonymous's block: MV grid district visualization
forked from anonymous's block: MV grid district visualization
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
</style> | |
</head> | |
<body> | |
<script> | |
var width = 960, | |
height = 1160; | |
var svg = d3.select("body").append("svg") | |
d3.json("mv_grid_district_3500-3600.geojson", function(error, mv) { | |
if (error) return console.error(error); | |
console.log(mv); | |
var center = d3.geoCentroid(mv) | |
var scale = 150; | |
var offset = [width/2, height/2]; | |
var projection = d3.geoMercator() | |
.scale(width / 2 / Math.PI) | |
//.scale(100) | |
.translate([width / 2, height / 2]) | |
// create the path | |
var path = d3.geoPath().projection(projection); | |
svg.append("path") | |
.attr("d", path(mv)); | |
}) | |
</script> | |
</body> |