IMAGINE Discussions

Discuss and share topics of interest using ERDAS IMAGINE the world’s leading geospatial data authoring system.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 106
Registered: ‎06-03-2016
Accepted Solution

Feature Count after 'Filter By Attributes'

[ Edited ]

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

Frequent Contributor
Posts: 106
Registered: ‎06-03-2016

Re: Feature Count after 'Filter By Attributes'

Disregard. I piped the FilterByAttributes result into a SelectAttributes node and can use either NumItems or RowCount to get a count. 

 

Regards

Frequent Contributor
Posts: 106
Registered: ‎06-03-2016

Re: Feature Count after 'Filter By Attributes'

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

 

Staff
Posts: 14
Registered: ‎07-11-2016

Re: Feature Count after 'Filter By Attributes'

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

 

Contributor
Posts: 59
Registered: ‎04-19-2016

Re: Feature Count after 'Filter By Attributes'

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!

Frequent Contributor
Posts: 106
Registered: ‎06-03-2016

Re: Feature Count after 'Filter By Attributes'

Yes sir, there is a new operator in version 16.1 named FeatureInformation that will provide a count.

I'll ask Kumar to email you the link to the update.

Regards
Contributor
Posts: 59
Registered: ‎04-19-2016

Re: Feature Count after 'Filter By Attributes'

Ok thanks!

 

Yes please send me the update to 16.1 Kumar.

 

Thanks!

Contributor
Posts: 59
Registered: ‎04-19-2016

Re: Feature Count after 'Filter By Attributes'

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? 

Frequent Contributor
Posts: 106
Registered: ‎06-03-2016

Re: Feature Count after 'Filter By Attributes'

Hi Jens,

Yes, it works. I'm on my cell so I don't have access to my model, but the featureCount output port is an integer, so use a relational operator like equal, greater than, etc. Let me know if you have trouble and I'll post a sample model when I get home tonight.

Regards
Staff
Posts: 14
Registered: ‎07-11-2016

Re: Feature Count after 'Filter By Attributes'

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.