For this work, I need to compute the "people distance" between voters in one precinct to the voters in every other precinct in the state. I can then run spatial correlation analysis (e.g. spatial lag model) on a
people-distance basis vs. a physical distance basis. To do this, armed with the voting-age population in each precinct, I believe I need to:
1) Determine the geographic center (centroids) of a state's voting precincts from e.g. Redistricting Data Hub shapefiles
2) Draw a straight line between each pair of centroids, then determine the length of each line segment within the precincts on the intervening path between these two endpoint centroids. I can then compute the people distance by weighting each segment
length along this path by that intervening precinct's population density.
I believe that #1 is straightforward using Geopandas once I can figure out how to install that on my Windows machine.
For #2, I could imagine digitizing the line as a series of points, then somehow determining which precinct encompasses each of those points. Or perhaps someone has already coded such an algorithm.