07-22-2016 09:45 PM - edited 07-22-2016 09:46 PM
Folks,
How do I count the number of features identified by a Filter By Attributes (FbA) operation?
I piped the results of FbA to the MeasurePolygon (MP) operator and it errored out saying there were no features, but when attached a NumCount operator to FbA I get 1, which contradicts the MP op.
Advice would be appreciated.
Regards
Solved! Go to Solution.
07-23-2016 12:04 PM
Disregard. I piped the FilterByAttributes result into a SelectAttributes node and can use either NumItems or RowCount to get a count.
Regards
08-07-2016 03:50 PM
Using SelectAttributes to get a RowCount doesn't work when the result set is empty. The IsEmpty operator returns False and NumItems returns 1 even when the result set is empty.
Anyone know which operator yields an accurate 'feature count' after FilterByAttributes that also handles the case of an empty set (zero features)? I'd like to use a RequireCondition operator to provide users with a more meaningful error message when the recipe's assertions are invalidated.
Regards
08-08-2016 11:46 AM
Noel,
We have an operator in our road map to get the Feature count and other information like CRS. Currently we have to use solutions like the workaround you proposed, which is not without its issues.
We have the erroring of some feature operators when the feature stream has 0 records as a defect.
Regards
09-21-2016 12:42 AM
Hi Noel,
Any luck with the work around??
Desperately need a conditional operator with count to stop a line of processing if the feature is empty, and if empty move to the next operator.
Let me know!
09-21-2016 05:53 AM
09-21-2016 05:56 AM
Ok thanks!
Yes please send me the update to 16.1 Kumar.
Thanks!
09-22-2016 03:48 AM
Hi Noel,
Did you get the feature count to work in your model?
If I select features by attribute, then use feature information, and then use the "is empty" operator to determine if there are features it returns True (meaning empty) even for filtered outputs that I definitely know they have features?!
Another bug?
09-22-2016 07:40 AM
09-22-2016 08:52 AM
The Features Information operator provides information about a set of features. By default the information provided comes from the input features' metadata and in some cases the FeatureCount and Boundary may not be available unless it is computed by examining all of the features. If your model must have the feature count, set the ForceFeatureCount port to true. Likewise, if your model must have the features' boundary, set the ForceBoundary port to true. In both cases there is no performance penalty if the input feature metadata provides the information. All features are only examined if the information is not available.
Hope this helps.