General Description: Student project which aimed to generate hypothetical polling place locations and voting precinct boundaries, given hypothetical voter residence locations, potential polling place facilities, a street network, and a study area boundary. This is accomplished by using the Network Analyst functionality of ArcGIS to solve a location-allocation problem.
The meat of this project is contained in PPP_generator.py. The purpose is to select optimal polling place locations and generate voting precinct boundaries, with the goal of minimizing the number of polling place facilities required to serve each voter and ensuring that no voter is farther than a maximum distance from a polling place along the street network. The required inputs are a feature class of voter residence locations (hypothetical), a feature class of potential polling place facilities with an assumed capacity attribute (how many voters can be accommodated on election day), a street network, and a study area boundary (in my case a city limit). In my project I used a random subset of 30% of all voter residence points, to represent a hypthetical 30% voter turnout rate. The script uses the Network Analyst extension in ArcGIS (so the user must have this extension enabled). The script first creates and builds a network dataset, creates a location-allocation analysis layer, and then solves a location-allocation problem. The outputs are a feature class of selected polling place locations (points) and a feature class of voting precinct boundaries (polygons).
The result achieved thus far does enforce a maximum distance from each voter to their assigned polling place, but it does not optimize for capacity of facilities as desired, because it allocates too many voters to some facilities and not enough to others. However, I believe this can be solved by changing the type of Location-Allocation Analysis Problem, or possibly by changing some other parameters.
An additional script, copy_voter_points.py, used in developing the hypothetical (assumed) voter residence locations, is also included. The input for this script is a feature class containing one point for each residential building in the study area, with an attribute for assumed number of voters who live in each building. The script makes copies of each voter point so that each individual voter will have a point in the output feature class. If 10 voters are assumed to live in a building, then 9 additional copies of that point will be made, so there will now be 10 voter points at that location.