collegematt28

Python coding for point distance

Discussion created by collegematt28 on Mar 31, 2014
Latest reply on Apr 22, 2014 by mdenil
I am a bit stuck and hoping someone can help.   I have some python experience, but am getting stuck on the best rout forward for a specific function I am trying to run.

I have two point shapefiles.  The first is a list of polling locations for the county I live, with the precinct number that corresponds to that location.  the second shapefile is a geocode of all the voters in that county.  Each voter has their precinct number in the attribute table.

What I am hoping to do is run a code that will calculate the distance each voter is from their designated polling spot.  I am assuming Ishould use point distance and a combination of an IF or/and FOR loop to run the function when the precinct numbers from the two distinct shapefiles match.  However, I am unsure how to move forward in writing that code.  If anyone has any suggestions, or a better method, the help would be appreciated.

Matthew

Outcomes