Hi,I have a shape with polynones. I want to select 30% of the polygons at random. Is that possible?
Hi,I have a shape with polynones. I want to select 30% of the polygons at random. Is that possible?
I think the Advanced Sampler from the Hub would be what you are looking for using the Sampling Rate and Randomize Sampling options.
You could also use the default Sampler also with Randomize Sampling and have a sampling rate of 3 using the every Nth feature sampling type
The sampler does indeed work. But if I create a user_parameter that specifies a percentage. If I then use an Expression Evaluator to determine how many surfaces there are, I cannot pass on the result of the expression evaluator to the sampler. It only accepts user_parameter or a number. How can I put a calculated value in the Sampling Rate (n)?
Can you use the AdvancedSampler from FME Hub, like
If the AdvancedSampler does not work you can try the following:
A RandomNumberGenerator/Sorter combination to randomize the order of your features. Use a Counter to give your features a _count attribute.
Using the total number of features (derived from e.g. joining the results of a StatisticsCalculator back to your input) you can calculate the number of features within your percentage.
You can then use a Tester to check if feature's_count attribute is less than the number of features in your percentage.
You could probably do the latter part in a PythonCaller as well.