I have a series of line segments that I would like to use to find the count of points within 200 meters of each segment. Im having issues with the loop i have generated and I feel stumped on this one...
ClassLoc_Events_Lyr <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>ClassLoc_Events_Sort<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ClassLoc_Events_Lyr"</SPAN><SPAN class="punctuation token">)</SPAN>
Point_ClassLoc_FC_Lyr <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>Poly_ClassLoc_FC<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Point_ClassLoc_FC_Lyr"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN>ClassLoc_Events_Lyr<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"OID@"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"DWELLINGS_COUNT"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> ClassLoc_Segments<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> Segment <SPAN class="keyword token">in</SPAN> ClassLoc_Segments<SPAN class="punctuation token">:</SPAN>
Seg <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByAttribute_management<SPAN class="punctuation token">(</SPAN>ClassLoc_Events_Lyr<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NEW_SELECTION"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"OBJECTID = {}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>Segment<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
Sel <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByLocation_management<SPAN class="punctuation token">(</SPAN>Point_ClassLoc_FC_Lyr<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"WITHIN_A_DISTANCE"</SPAN><SPAN class="punctuation token">,</SPAN> Seg<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"200 Meters"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NEW_SELECTION"</SPAN><SPAN class="punctuation token">)</SPAN>
Out <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>Sel<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ID_Points_Lyr"</SPAN><SPAN class="punctuation token">)</SPAN>
Point_Count <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>GetCount_management<SPAN class="punctuation token">(</SPAN>Out<SPAN class="punctuation token">)</SPAN>
Segment<SPAN class="punctuation token">.</SPAN>setValue<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"DWELLINGS_COUNT"</SPAN><SPAN class="punctuation token">,</SPAN> Point_Count<SPAN class="punctuation token">)</SPAN>
ClassLoc_Segments<SPAN class="punctuation token">.</SPAN>updateRow<SPAN class="punctuation token">(</SPAN>Segment<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Delete_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"ID_Points_Lyr"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>So the loop is supposed to update the line segments. First supposed to select the first row. Next it should then search within 200 meters of the selected row and make a new selection including only the points within the proximity. Then it makes a a seperate feature layer out of the selection in order to do the next step. Next step is to get a count of the selected points. Then it is supposed to update the row "DWELLINGS_COUNT" with the counted points. Finally the loop goes to the next row and the process repeats.
Getting an error on line 10:
AttributeError: 'list' object has no attribute 'setValue'