Skip to main content
Question

Sampler that will stop after n features

  • April 11, 2019
  • 1 reply
  • 69 views

Forum|alt.badge.img

Hello,

 

I'm using sampler to reduce the output. If some parameters are set then I want to only read n rows and then move on with processing without reading all the rest.

 

I know that in feature reader there is option to set: max features to read but then I perorm some polygon filtering so there is a chance that if i set it to 1000 then 0 features will be stored because none is inside filter polygon.

 

Sampler works great but problem with it is that after sampling first n records it still keeps on reading new features but it forwards it to notSampled port.

 

So is there any option that would stop reading more features after reaching given number?

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • April 11, 2019

@witos

 

That would require the outcome of your inside filter at nth feature to be looped back to stop the reader. I don't think that's possible with a standard reader, afaik.

 

  1. I think you could create such a thing if you use a feature reader (or a workspacerunner) and have it read 1 feature at a time. You would have to test when the nth feature after inside poly check has been reached, as long as it is not reached you call the featurereader. (or workspacerunner).I presume this would be a (very) slow process, for you may need a lot of calls.

 

2 - If you got your data in a spatial database, you can do this through SQL.

 

3 - Depending on the datasource type, you might do some pre-spatialfiltering. Use a feature reader on the dataset and and as initiator your (aggregated if you got more then 1 filter) . Use the SpatialFilter option, select appropriate filter. You can then set you n-sample on the result. Not exactly what you are asking but it will reduce amount read.

 

 

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings