Hello,
I'm a totally newbie to Python and have problems to calculate the area of an input feature in my model (model builder).
I use the "Calculate Value" function to calculate the area (in square kilometers or meters) of an input feature (either a raster or a vector feature - should both work?).
I found out that it works like that: !shape.area@squarekilometers!
I have my forumla in the expression block like x/200 and want to calculate the area of myFeature represented by x.
My code block is the following: x = !myFeature.area@squarekilometers!
I also tried the following: x = !%myFeature%.area@squarekilometers!
But I always get an error (ERROR 000989 Python syntax error: Parsing error SyntaxError: invalid syntax (line 1)).
Does anyone know what I'm doing wrong?
Thank you!
I'm a totally newbie to Python and have problems to calculate the area of an input feature in my model (model builder).
I use the "Calculate Value" function to calculate the area (in square kilometers or meters) of an input feature (either a raster or a vector feature - should both work?).
I found out that it works like that: !shape.area@squarekilometers!
I have my forumla in the expression block like x/200 and want to calculate the area of myFeature represented by x.
My code block is the following: x = !myFeature.area@squarekilometers!
I also tried the following: x = !%myFeature%.area@squarekilometers!
But I always get an error (ERROR 000989 Python syntax error: Parsing error SyntaxError: invalid syntax (line 1)).
Does anyone know what I'm doing wrong?
Thank you!