Skip to content

Instantly share code, notes, and snippets.

@geobabbler
Created March 31, 2020 16:41
Show Gist options
  • Save geobabbler/293717732cd3486b56ae9416eed57202 to your computer and use it in GitHub Desktop.
Save geobabbler/293717732cd3486b56ae9416eed57202 to your computer and use it in GitHub Desktop.
#!/bin/bash
###################################################
# Bash script to pull JHU data and update
###################################################
#Set the value of variable
database="$1"
user="$2"
host="$3"
pw="$4"
export PGPASSWORD="$4"
ogr2ogr -overwrite -f "PostGreSQL" PG:"host=$host user=$user dbname=$database password=$pw" 'https://services1.arcgis.com/0MSEUqKaxRlEPj5g/ArcGIS/rest/services/ncov_cases_US/FeatureServer/0/query?where=1%3D1&outFields=*&f=geojson&token=' -nln jhu_county_current
psql -d $database -h $host -U $user -c "UPDATE jhu_county a SET last_update = b.last_update, confirmed = b.confirmed FROM jhu_county_current b WHERE a.combined_key = b.combined_key AND a.confirmed <> b.confirmed;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment