Skip to content

Instantly share code, notes, and snippets.

@dholstius
Forked from mbostock/.block
Last active August 29, 2015 14:09
Show Gist options
  • Save dholstius/db17b68902437d0e3279 to your computer and use it in GitHub Desktop.
Save dholstius/db17b68902437d0e3279 to your computer and use it in GitHub Desktop.
California census tracts
.DS_Store
build
node_modules
GENERATED_FILES = \
ca.json
all: $(GENERATED_FILES)
.PHONY: clean all
clean:
rm -rf -- $(GENERATED_FILES) build
build/tl_2012_%_tract.zip:
mkdir build
curl -o $@ 'http://www2.census.gov/geo/tiger/TIGER2012/TRACT/$(notdir $@)'
build/tracts.shp: build/tl_2012_06_tract.zip
rm -rf $(basename $@)
mkdir -p $(basename $@)
unzip -d $(basename $@) $<
for file in $(basename $@)/*; do chmod 644 $$file; mv $$file $(basename $@).$${file##*.}; done
rmdir $(basename $@)
touch $@
ca.json: build/tracts.shp
node_modules/.bin/topojson -o $@ --q0=0 --simplify=1 --projection='d3.geo.mercator().center([-122.4183, 37.7750]).scale(2700).translate([300, 300]).precision(0)' --id-property=TRACTCE -- $(filter %.shp,$^)
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.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment