Skip to content

Instantly share code, notes, and snippets.

@albert-decatur
Last active August 29, 2015 14:24
Show Gist options
  • Save albert-decatur/d3d5b4b1b8621a552c4b to your computer and use it in GitHub Desktop.
Save albert-decatur/d3d5b4b1b8621a552c4b to your computer and use it in GitHub Desktop.
processing TIGER/Line roads
# download them all
wget -ci <( baseuri="ftp://ftp2.census.gov/geo/tiger/TIGER2014/ROADS/"; escaped_baseuri=$(echo "$baseuri" | sed "s:\/:\\\/:g" | sed "s/:/\\\:/g"); lftp -e 'find;exit' "$baseuri" | sed "s:^:${escaped_baseuri}:g" )
# make single text file of unique FULLNAME roads names
find_ext zip | parallel -j2 'tmp=$(mktemp -d); unzip -d $tmp {} $(basename {} .zip).dbf; dbfdump --fields FULLNAME $tmp/*.dbf | grep -vE "^\s*$"; rm -r $tmp' | grep -vE "(Archive|inflating)[:]" | sed '1 i\FULLNAME'| sortfreq > ~/fullname_uniq.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment