I have a set of points that I need to cycle through and for each point, spatially select the polygon in which that particular point falls. I then need to compare a couple values in the point to the value of a field in the selected polygon.
Stepping through the points is easily accomplished with an arcpy.da.SearchCursor; I can make the spatial selection easily too. But how do I get the value of a particular field in the selected polygon? (It's my understanding that nesting another search cursor after Line 4 is bad practice.)
fields <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"StreetDir"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"HouseDir"</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"points"</SPAN><SPAN class="punctuation token">,</SPAN>fields<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByLocation_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"quads"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"CONTAINS"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"points"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
StreetDir and HouseDir have values of N,S, E or W.
The quads feature layer has a field called DirValues in the form of a tuple: ("S", "W") or ("S", "E") etc. I need to see if row[0] and row[1] are in the selected tuple.
Is there a way to tease values out with describe? Or is there some "get-selected-feature-field-value" method I haven't found with google?