fitnr / get-tiger Goto Github PK
View Code? Open in Web Editor NEWMake workflow for downloading Census geodata and joining it to survey data
License: GNU General Public License v3.0
Make workflow for downloading Census geodata and joining it to survey data
License: GNU General Public License v3.0
Hello! Thank you for your swift response. Now "make" and "make -f ini.mk YEAR=2020" work, but I still cannot download the data sets. Here below, I list the commands and the error messages for your reference.
make
Available data sets:
(run with "make DATASET")
NATION - United States
DIVISION - four very broad sections of the country
REGION - nine broad sections of the country
AIANNH - American Indian areas, Alaska Native areas, Hawaiian home lands
AITSN - American Indian tribal subvidisions
ANRC - Alaska Native regional corporations
BG - Block groups
CNECTA - Combined New England city and town areas
CBSA - Core-based statistical qreas
CD - Congressional districts
CONCITY - Consolidated cities
COUNTY - Counties
COUNTY_WITHIN_UA - Urban areas segmented by county
COUSUB - County subvidisions
CSA - Consolidated statistical areas
ELSD - Elementary school districts
ESTATE - Estates [US Virgin Islands]
METDIV - Metropolitan Divisions
MIL - Military areas
NECTA - New England city and town areas
NECTADIV - New England city and town area divisions
PLACE - Places
PRIMARYROADS - Primary roads [national]
PRISECROADS - Primary and secondary roads [by state]
PUMA - Public use microdata areas
RAILS - Railroads
ROADS - Roads. Downloads one file for each county, then combines into state files.
SCSD - Secondary school districts
SLDL - State legislative districts [lower chamber]
SLDU - State legislative districts [upper chamber]
STATE - States and territories
SUBBARRIO - Sub-barrios [Puerto Rico]
TABBLOCK - Blocks
TBG - Tribal block groups
TRACT - Census tracts
TTRACT - Tribal Census tracts
UAC - Urbanized areas
UNSD - Unified school districts
ZCTA5 - Zip code tabulation areas
AREAWATER - Water polygons. Downloads one file for each county, then combines into state files.
LINEARWATER - Water lines. Downloads one file for each county, then combines into state files.
default year is 2019
make NATION STATE
curl -Lo 2019/NATION/cb_2019_us_nation_5m.zip -sS --retry 10 --retry-delay 1 --connect-timeout 2 ftp://ftp2.census.gov/geo/tiger/GENZ2019/shp/NATION/cb_2019_us_nation_5m.zip
curl: (28) Operation timed out after 2000 milliseconds with 0 out of 0 bytes received
make: *** [2019/NATION/cb_2019_us_nation_5m.zip] Error 28
make COUNTY TRACT
curl -Lo 2019/cb_2019_us_county_500k.zip -sS --retry 10 --retry-delay 1 --connect-timeout 2 ftp://ftp2.census.gov/geo/tiger/GENZ2019/shp/cb_2019_us_county_500k.zip
curl: (28) Operation timed out after 2001 milliseconds with 0 out of 0 bytes received
make: *** [2019/cb_2019_us_county_500k.zip] Error 28
make PLACE
curl -Lo 2019/cb_2019_01_place_500k.zip -sS --retry 10 --retry-delay 1 --connect-timeout 2 ftp://ftp2.census.gov/geo/tiger/GENZ2019/shp/cb_2019_01_place_500k.zip
curl: (28) Operation timed out after 2001 milliseconds with 0 out of 0 bytes received
make: *** [2019/cb_2019_01_place_500k.zip] Error 28
make TRACT CARTOGRAPHIC=false
mkdir -p 2019/TRACT
curl -Lo 2019/TRACT/tl_2019_01_tract.zip -sS --retry 10 --retry-delay 1 --connect-timeout 2 ftp://ftp2.census.gov/geo/tiger/TIGER2019/TRACT/tl_2019_01_tract.zip
curl: (28) Operation timed out after 2004 milliseconds with 0 out of 0 bytes received
make: *** [2019/TRACT/tl_2019_01_tract.zip] Error 28
make -f ini.mk YEAR=2020
mkdir -p 2020/COUNTY
curl -Lo 2020/COUNTY/2020_Gaz_counties_national.zip ftp://ftp2.census.gov/geo/docs/maps-data/data/gazetteer/2020_Gazetteer/2020_Gaz_counties_national.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 138k 100 138k 0 0 20074 0 0:00:07 0:00:07 --:--:-- 30389
unzip -p 2020/COUNTY/2020_Gaz_counties_national.zip |
iconv -f Windows-1252 -t UTF-8 | tail -n+2 | cut -f 2 |
awk '{ arr[substr($1, 1, 2)] = arr[substr($1, 1, 2)] FS substr($1, 3) } END
{for (i in arr) {print "COUNTIES_" i " ="arr[i] } }' |
sort > counties/2020.ini
make 2013/BG.shp YEAR=2013
make: *** No rule to make target `2013/BG.shp'. Stop.
As the file of cb_2019_us_nation_5m.zip can be downloaded manually from ftp://ftp2.census.gov/geo/tiger/GENZ2019/shp/cb_2019_us_nation_5m.zip,
I was thinking the error could be due to a change in FTP address, so I tried to make changes in the Makefile, e.g., from
NATION := NATION/cb_$(YEAR)_us_nation_5m.zip
into
NATION := cb_$(YEAR)_us_nation_5m.zip
, and then run: make NATION STATE. However, I receive
curl -Lo 2019/cb_2019_us_nation_5m.zip -sS --retry 10 --retry-delay 1 --connect-timeout 2 ftp://ftp2.census.gov/geo/tiger/GENZ2019/shp/cb_2019_us_nation_5m.zip
curl: (28) Operation timed out after 2002 milliseconds with 0 out of 0 bytes received
make: *** [2019/cb_2019_us_nation_5m.zip] Error 28
Could you kindly check? Many thanks!
Hello fitnr, thank you for sharing "get-tiger". I'm sure it's the tool that I need to download census TIGER Line shapefiles, but it seems "make" doesn't work for me.
I follow the instructions for OS X users: "install make with: xcode-select --install. For GDAL, install Homebrew and run: brew install gdal." I also use "gh repo clone fitnr/get-tiger" to download the repo and put the contents in the folder I would like to fill with GIS data.
However, when I run "make", it reports: "Makefile:12: key.ini: No such file or directory make: *** No rule to make target `key.ini'. Stop."
I cannot find a file of "key.ini" in the repo but the Makefile mentions it. I do have a census API key with me. Could you please share the key.ini or the way to prepare the file? Thanks!
This seems like a great tool. Because of the (Seemingly fickle) nature of census API and FTP sites, I wasn't able to download anything. I kept getting 425 errors when curling. Also, it seems like make commands switch to 2015/COUNTY/cb_2015_us_county_20m.zip ftp://ftp2.census.gov/geo/tiger/GENZ2015/shp/cb_2015_us_county_20m.zip
regardless of what is entered.
Perhaps I am doing something wrong?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.