# Set some variables SHP_FILES_DIRECTORY = "" # absolute path of downloaded .zip files along with dataset. UNZIP_DEST_DIRECTORY = "" # destination folder to unzip into .shp files HOST_NAME = "" # postgres hostname DB_NAME = "" # postgres database PG_USER = "" # postgres user # Unzip all the shapefiles unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_state -d $(UNZIP_DEST_DIRECTORY)/state unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_county -d $(UNZIP_DEST_DIRECTORY)/county unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_coastline -d $(UNZIP_DEST_DIRECTORY)/coastline unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_cbsa -d $(UNZIP_DEST_DIRECTORY)/cbsa unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_mil -d $(UNZIP_DEST_DIRECTORY)/mil unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_primaryroads -d $(UNZIP_DEST_DIRECTORY)/roads unzip $(SHP_FILES_DIRECTORY)/tl_2023_us_rails -d $(UNZIP_DEST_DIRECTORY)/rails # Load all these shapefiles into your postgres database with postgis extension enabled. shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/state/tl_2023_us_state.shp public.tl_2023_us_state | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/county/tl_2023_us_county.shp public.tl_2023_us_county | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/coastline/tl_2023_us_coastline.shp public.tl_2023_us_coastline | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/cbsa/tl_2023_us_cbsa.shp public.tl_2023_us_cbsa | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/mil/tl_2023_us_mil.shp public.tl_2023_us_mil | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/roads/tl_2023_us_primaryroads.shp public.tl_2023_us_primaryroads | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER shp2pgsql -D -I -s 4269 $(UNZIP_DEST_DIRECTORY)/rails/tl_2023_us_rails.shp public.tl_2023_us_rails | psql -d $DB_NAME -h $HOST_NAME -U $PG_USER