I have a model that isolates a place's road network based on my input of the place's name. What I need to determine is if any of the road segments in the network are greater than 500m. To do so I've written the following into a Calculate Value tab in ModelBuilder:
def isLongerThanAllowed():
import arcpy
fc = "C:\Users\USER1\Documents\ArcGIS\Scratch.gdb\placeNetwork"
fields = "LENGTH_GEO"
with arcpy.da.SearchCursor (fc, fields) as cursor:
#iterate rows
for row in cursor:
if row > 500:
return "TRUE"
else:
return "FALSE"
For some reason it is returning True even when all road lengths are less than 500m.
The end goal is to use another model I created that splits the road features greater than a certain distance in two so that no segments are greater than 500m. So the logic of the end result will be "while the road network has roads greater than 500m, run the split model".