So my question is, what if I want to limit my da.SearchCursor results so that it did not select lines of a particular length.
For example, the following code, is what I tried, but then...
PairedChaeck <SPAN class="operator token">=</SPAN> <SPAN class="comment token">#a featureclass</SPAN>
length <SPAN class="operator token">=</SPAN> <SPAN class="comment token">#some value</SPAN>
cursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'PairedCheck6'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SHAPE@TRUECENTROID'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SHAPE@LENGTH'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> where_clause<SPAN class="operator token">=</SPAN> <SPAN class="string token">'SHAPE@LENGTH <> length'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I get the following error: A column was specified that does not exist. Failed to execute (CalculateField). And refers to line 7 of the following snippet.
cursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'PairedCheck6'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'SHAPE@TRUECENTROID'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'SHAPE@LENGTH'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> where_clause<SPAN class="operator token">=</SPAN> <SPAN class="string token">'SHAPE@LENGTH <> length'</SPAN><SPAN class="punctuation token">)</SPAN>
centroid <SPAN class="operator token">=</SPAN> None
<SPAN class="comment token">#collect results</SPAN>
results <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">for</SPAN> result <SPAN class="keyword token">in</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
results<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN>result<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>
Is it even possible to reference a geometry token like that in a where clause? I would prefer not to have to make a knew column called length just for that piece of logic.