Greensboro, North Carolina, has a problem with food availability. Namely, there are large portions of the city where the nearest source of fresh food is several miles away. Unsurprisingly, these often tend to be the poorer parts of the city where not everyone has ready access to a car.
The Greensboro Code for America Brigade wanted to look into the issue, so I set about getting the data into a form we could work with locally. Below are the steps to follow to load the dataset into PostgreSQL.
Retrieving the food desert dataset
The food desert data and documentation can be downloaded as a single Excel file. However, it is keyed by census tract which means we will need the census tract information.
Loading 2010 US Census tracts
We will work off a modified version of these instructions to load U.S. Census tracts into a Postgres database.
First, assuming you are on Mac OS X, install
gdal via Homebrew:
and in Postgres, install the PostGIS extensions:
Next, download the Tiger data files from the FTP server:
Finally, load the data into Postgres. Change the
YOUR... variables to match your system.
Querying to find food deserts
longitude, you can determine whether it falls into a food desert or not with this query: