Hi All,
Just wanted to check with someone to make sure I'm not making a school boy error. I have a very simple model in ArcPro 3.0.2, it is shown below. It uses the get field value tool to return the geometry which feeds into a Calculate value tool, in this simple case I am returning the area (to show the problem), but in reality I might actually be accessing some other property such as extent.
Note output of Get Field Value is a precondition to Calculate Value.
The tools are as:
The input layer is nothing more than:
The model never completes as it appears to be returning a NULL geometry?
Executing (Get Field Value): GetFieldValue test2 Shape Polygon #
Start Time: 04 November 2022 13:00:44
Succeeded at 04 November 2022 13:00:44 (Elapsed Time: 0.01 seconds)
Executing (Calculate Value): CalculateValue test(%polygon%) "def test(poly):
return poly.area" Double
Start Time: 04 November 2022 13:00:44
The process did not execute because the precondition is false.
Succeeded at 04 November 2022 13:00:44 (Elapsed Time: 0.00 seconds)
Tagging @ShitijMehta , @KoryKramer
There is nothing in the help file to indicate that this tool does not work with the SHAPE field. I would have expected it to work with the SHAPE field as I am allowed to set the output data type to various geometry types?
Solved! Go to Solution.
Hello DuncanHornby,
Get field value just gets the value only and not the geometry. In case where you are returning a polygon the output is empty. I don't thing we should be showing the shape in the get field value tool as a valid choice to for field to get the value from. a bug for us.
You can still pass test2 to cal value tool directly as inline and then describe it and get the extent/etc from it.
Hope this helps.
Hi,
Why do you need to use get field value?
Are you iterating over each row?
You might be able to simply do this?
Hi,
I use the Get field tool as I only need to read the first row, which is what the tool does. My concern is that it appears that I can select the Shape field as the field to extract data from but it does not seem to output a geometry (polygon in my case) as when I feed it into the Calculate value tool it is Null? In your example what is a? I see you embed it in quotes. So from my testing its not clear if the Get Field tool is failing to output a geometry or its the Calculate Value tool failing to read a geometry object. In your example you are taking a string.
a is a feature class/layer/ string with path. I am describing it to get the extent like the test2 polygon in your first comment.
Share your model or image of the cal val tool dialog and the workflow before and after that. If you want to get the first row value - get field value is the right tool, but why do u need the first row value and what value is it?
My original post is the workflow, its really that simple. In your reply your are extracting the extent of a layer I want to extract out a property of a geometry that happens to be in a featureclass at the first row. But it feels like you are getting distracted by the why case (which could be many). My question is simply does the model only tool Get Field Value honour the geometry column? I can choose polygons/points/lines but my simple model above fails and its not possible to determine if the Get Field tool is failing to output a geometry or its the Calculate Value tool failing to read a geometry object. You are passing in strings, I am not. Why would the Get Field tool allow me to choose the output data type if it can't actually pass it out as input into another tool?
Hello DuncanHornby,
Get field value just gets the value only and not the geometry. In case where you are returning a polygon the output is empty. I don't thing we should be showing the shape in the get field value tool as a valid choice to for field to get the value from. a bug for us.
You can still pass test2 to cal value tool directly as inline and then describe it and get the extent/etc from it.
Hope this helps.
Thanks for confirming that it is the Get Field Value tool that is at fault. I agree if geometry is not honoured then the shape field should not be an option. I think the output data type list should be stream-lined to the only data types a Get Field Value tool can actually output. Also I would recommend that the help file is updated to explicitly state that geometry is not something that it can use.