Sunday, 5 November 2017

Using Range in Python expression of ArcGIS Field Calculator?


what is the python expression for defining a range of numbers?


I have tried numerous combinations but cannot get a simple range of angles (100 -200) to compute correctly.


Screen shot :


Range in Field Calculator needed



Answer



if !ET_Angle! > 100 and !ET_Angle! < 200

To be more complete, put this in the codeblock:


def LeftOrRight(value):

if value > 100 and value < 200:
return "LEFT"
else:
return "RIGHT"

And in the calculation area, just put:


LeftOrRight(!ET_Angle!)

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...