Python: point in polygon, then looping

2133
1
04-10-2010 08:21 AM
JoshFrederick
New Contributor
I was hoping someone could help get me started.  I have two shapefiles: an address point file and a parcel polygon file.  Each parcel as a unique PIN #; similarly, if an address point is within a parcel, it will have a matching PIN #.  Sometimes these PIN #s go unmatched and this is where i want to create a script.

I want to loop through the parcel table, determine if the parcel contains any address points, and if so compare the PIN #s to make sure they match.  If they don't match, then use VBA to print the address of the point out in the window.

I'm still sort of a beginner with scripting with python, but can do basic scripts and VBA stuff.   How would I use it to determine if each parcel contains any address points??  I was thinking spatial join but am still unsure....thanks in advance.
0 Kudos
1 Reply
FrankVignati
Occasional Contributor II
I was hoping someone could help get me started.  I have two shapefiles: an address point file and a parcel polygon file.  Each parcel as a unique PIN #; similarly, if an address point is within a parcel, it will have a matching PIN #.  Sometimes these PIN #s go unmatched and this is where i want to create a script.

I want to loop through the parcel table, determine if the parcel contains any address points, and if so compare the PIN #s to make sure they match.  If they don't match, then use VBA to print the address of the point out in the window.

I'm still sort of a beginner with scripting with python, but can do basic scripts and VBA stuff.   How would I use it to determine if each parcel contains any address points??  I was thinking spatial join but am still unsure....thanks in advance.


this would be clunky, but you could rename the PID field in the point layer to something like PID2, add XY coordinates, do the spatial join then calculate the the PID2 to PID field where PID does not equal PID2 then recreate the points from the XY coordinates
0 Kudos