Geopandas and GIS exploration

Got some good feedback and response from the reddit post and now I’m game to try some mapping functionality out using geopandas and matplotlib. Getting geopandas installed was a pain, but I did learn how to set up a new environment specifically for geographic analysis in the process.

Also fetched the TIGER shape files from the Census Bureau. First I downloaded their Partnership files, which is a larger collection they share with partners, then found a more direct file for DC Census Tracts.

I wanted to solve a problem I’ve encountered earlier in my data analysis exploration: mapping latitudes and longitudes to specific census tracts. This post was quite handy… not ashamed to say this script kiddie (yours truly) straight up ripped it off and implemented it into my code.

Once that algorithm did it’s work I wrote some code to validate the census tracts using the Census Block Conversions API on the FCC website. I ran ~1000 or so lats and longs randomly sampled from the data and of those 13 (1.3%) did not match the Census tract that the geopandas algorithm gave.

Investigating the false readings (all at lat 38.837 long -76.981), indicates that the algorithm is mistakenly thinking the intersection is in PG County: https://geo.fcc.gov/api/census/block/find?latitude=38.837&longitude=-76.981&censusYear=2020&showall=true&format=json

Leave a comment

Your email address will not be published.