Skip to content

Instantly share code, notes, and snippets.

@gplssm
Last active June 4, 2017 22:29
Show Gist options
  • Save gplssm/f44b1334d52085a9b168f5d3a884602d to your computer and use it in GitHub Desktop.
Save gplssm/f44b1334d52085a9b168f5d3a884602d to your computer and use it in GitHub Desktop.
MV grid district visualization
license: mit
<!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>
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