Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
bash tiger code working now
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-brokamp committed Sep 26, 2019
1 parent 906508c commit a8120b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 30 deletions.
25 changes: 25 additions & 0 deletions make_TIGER_S1200_2018_roads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# download
wget -r ftp://ftp2.census.gov/geo/tiger/TIGER2018/ROADS/*

# unzip files
mkdir ./all_2018_roads
find ftp2.census.gov -type f -name "*.zip" -print0 | xargs -0 -I{} unzip {} -d ./all_2018_roads


# subset all of the shapefiles to each of the road classes
mkdir ./TIGER2018_S1200_roads

# if ls is aliased to `ls --color` than ansi color strings will be returned, preventing the grep from working!
for f in `\ls all_2018_roads/ | grep .shp$`; do
ogr2ogr -where "MTFCC = 'S1200'" TIGER2018_S1200_roads/$f all_2018_roads/$f
done

# merge all of these together
# utility taken from the python-gdal package
ogrmerge.py -o all_TIGER_roads_2018.gpkg TIGER2018_S1200_roads/*.shp -progress -f GPKG

# cleanup
rm -r ftp2.census.gov
rm -r all_2018_roads
rm -r TIGER2018_S1200_roads

30 changes: 0 additions & 30 deletions make_roads.sh

This file was deleted.

0 comments on commit a8120b3

Please sign in to comment.