AnsweredAssumed Answered

Using A Geometry Token in the Where Clause

Question asked by alexander.c.audet@maine.edu on Dec 1, 2017
Latest reply on Dec 5, 2017 by bixb0012

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 = #a featureclass
length = #some value
cursor = arcpy.da.SearchCursor('PairedCheck6',['SHAPE@TRUECENTROID', 'SHAPE@LENGTH'], where_clause= 'SHAPE@LENGTH <> length')

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 = arcpy.da.SearchCursor('PairedCheck6',['SHAPE@TRUECENTROID', 'SHAPE@LENGTH'], where_clause= 'SHAPE@LENGTH <> length')
        centroid = None
       
        #collect results
        results = []
        for result in cursor:
            results.append(result)

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. 

Outcomes