RTI International released obesity data for the US at the neighborhood level in 250×250 meter grid squares. I downloaded the state files and joined them together into a single PostGIS layer.
wget 'http://synthpopviewer.rti.org/obesity/downloads/AL.zip' 7za e AL.zip /Applications/Postgres93.app/Contents/MacOS/bin/shp2pgsql -s 3857 '/Users/sparafina/projects/obesity/AL.shp' obesity | /Applications/Postgres93.app/Contents/MacOS/bin/psql -U sparafina -d food_access /Applications/Postgres93.app/Contents/MacOS/bin/psql -U sparafina -c 'delete from obesity' -d food_access rm AL.s* AL.cpg AL.dbf AL.prj AL.zip for s in {'AL','AZ','AR','CA','CO','CT','DE','DC','FL','GA','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY'} do f='/Users/sparafina/projects/obesity/'$s'.shp' echo $f wget 'http://synthpopviewer.rti.org/obesity/downloads/'$s'.zip' 7za e $s'.zip' /Applications/Postgres93.app/Contents/MacOS/bin/shp2pgsql -a -s 3857 $f obesity | /Applications/Postgres93.app/Contents/MacOS/bin/psql -U sparafina -d food_access done /Applications/Postgres93.app/Contents/MacOS/bin/psql -U sparafina -c 'create index obesity_gist on obesity using gist (geom)' -d food_access
I converted the grids into points by generating the centroids of the grid.
CREATE TABLE obesity_point AS SELECT popgte20, popbmige30, bmivsus, pctbmige30, ST_Centroid(ST_Transform(geom, 4269)) AS geom FROM obesity; CREATE INDEX obesity_point_gist ON obesity_point USING gist(geom);
The points were then joined to Census tracts and their values were averaged by tract.
CREATE TABLE obesity_tract AS SELECT AVG(o.popgte20) as avg_popgte20, AVG(o.popbmige30) AS avg_popbmige30, AVG(o.bmivsus) as avg_bmivsus, AVG(o.pctbmige30) as avg_octbmige30, MAX(o.popgte20) as max_popgte20, MAX(o.popbmige30) AS max_popbmige30, MAX(o.bmivsus) as max_bmivsus, MAX(o.pctbmige30) as max_octbmige30, MIN(o.popgte20) as min_popgte20, MIN(o.popbmige30) AS min_popbmige30, MIN(o.bmivsus) as min_bmivsus, MIN(o.pctbmige30) as min_octbmige30, COUNT(*) as total_points, t.censustract FROM obesity_point as o, food_access_tracts as t WHERE ST_Intersects(o.geom, t.geom) GROUP BY t.censustract;
The tracts with the obesity data were then joined to the food desert tracts from the USDA.
CREATE TABLE access_obesity_tract AS SELECT f.gid, f.statefp, f.countyfp, f.tractce, f.affgeoid, f.geoid, f.name, f.lsad, f.aland, f.awater, f.foodaccess_id, f.state, f.county, f.lilatracts_1and10, f.lilatracts_halfand10, f.lilatracts_1and20, f.lilatracts_vehicle, f.urban, f.rural, f.la1and10, f.lahalfand10, f.la1and20, f.latracts_half, f.latracts1, f.latracts10, f.latracts20, f.hunvflag, f.groupquartersflag, f.ohu2010, f.numgqtrs, f.pctgqtrs, f.lowincometracts, f.pop2010, f.uatyp10, f.lapophalf, f.lapophalfshare, f.lalowihalf, f.lalowihalfshare, f.lakidshalf, f.lakidshalfshare, f.laseniorshalf, f.laseniorshalfshare, f.lahunvhalf, f.lahunvhalfshare, f.lapop1, f.lapop1share, f.lalowi1, f.lalowi1share, f.lakids1, f.lakids1share, f.laseniors1, f.laseniors1share, f.lahunv1, f.lahunv1share, f.lapop10, f.lapop10share, f.lalowi10, f.lalowi10share, f.lakids10, f.lakids10share, f.laseniors10, f.laseniors10share, f.lahunv10, f.lahunv10share, f.lapop20, f.lapop20share, f.lalowi20, f.lalowi20share, f.lakids20, f.lakids20share, f.laseniors20, f.laseniors20share, f.lahunv20, f.lahunv20share, o.avg_popgte20, o.avg_popbmige30, o.avg_bmivsus, o.avg_octbmige30, o.max_popgte20, o.max_popbmige30, o.max_bmivsus, o.max_octbmige30, o.min_popgte20, o.min_popbmige30, o.min_bmivsus, o.min_octbmige30, o.total_points, o.censustract FROM obesity_tract as o INNER JOIN food_access_tracts as f ON o.censustract = f.censustract;
Each PostGIS layer was export to a sql file via pg_dump. The data is available as a zip file compressed with 7zip. The archive contains the following:
- obesity_grid.sql – the original RTI data of the US
- obesity_point.sql – RTI data as points
- obesity_tract.sql – RTI data averaged into Census tracts
- access_obesity_tract.sql – obesity and food desert data by Census tract