Skip to content

Instantly share code, notes, and snippets.

@nautilytics
Last active April 10, 2020 16:42
Show Gist options
  • Save nautilytics/057c46f62448f578552d60a9b6a439fb to your computer and use it in GitHub Desktop.
Save nautilytics/057c46f62448f578552d60a9b6a439fb to your computer and use it in GitHub Desktop.
Download and import Hurricane Sandy and US County shapefiles into a PostGIS database using shp2pgsql
#!/bin/bash
# Add US County data to Postgis w/ GIST index
curl https://www2.census.gov/geo/tiger/TIGER2019/COUNTY/tl_2019_us_county.zip --output tl_2019_us_county.zip
mkdir tl_2019_us_county
unzip tl_2019_us_county.zip -d tl_2019_us_county
shp2pgsql tl_2019_us_county/tl_2019_us_county.shp tl_2019_us_county | psql -d gis_db
psql -d gis_db -c "CREATE INDEX tl_2019_us_county_geom_gix ON tl_2019_us_county USING GIST (geom)"
# Add Hurricane Sandy Radii data to Postgis w/ GIST index
curl https://www.nhc.noaa.gov/gis/best_track/al182012_best_track.zip --output al182012_best_track.zip
mkdir al182012_best_track
unzip al182012_best_track.zip -d al182012_best_track
shp2pgsql al182012_best_track/al182012_radii.shp al182012_radii| psql -d gis_db
psql -d gis_db -c "CREATE INDEX al182012_radii_geom_gix ON al182012_radii USING GIST (geom)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment