Skip to content

Instantly share code, notes, and snippets.

@ix4
Forked from mbostock/.block
Created February 1, 2020 08:29
Show Gist options
  • Save ix4/48f6c65b831002a3dc8ef5e63270e12d to your computer and use it in GitHub Desktop.
Save ix4/48f6c65b831002a3dc8ef5e63270e12d to your computer and use it in GitHub Desktop.
New York Block Groups
license: gpl-3.0

13,837 census block groups; 13,866 polygons. 2.1M TopoJSON, 620K gzipped. Made by customizing the makefile in the U.S. Atlas project:

topojson \
	-o ny.json \
	--projection 'd3.geo.mercator().center([-75.819, 42.795]).scale(6193).translate([480, 350]).precision(0)' \
	-q 1e5 \
	-s .5 \
	-- blockgroups=shp/ny/blockgroups.shp
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
fill: none;
stroke: #000;
stroke-width: .5px;
stroke-linejoin: round;
stroke-linecap: round;
}
</style>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>
var width = 960,
height = 700;
var path = d3.geo.path()
.projection(null);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("ny.json", function(error, ny) {
if (error) throw error;
svg.append("path")
.datum(topojson.mesh(ny))
.attr("d", path);
});
d3.select(self.frameElement).style("height", height + "px");
</script>
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