2

Basically my question is quite simple:

  • I want to create certain amount of random points within polygons. The RandomPointGenerator does almost exactly what I want, but I'd like to pass the Number of Points from an attribute value that I have in one of the shapefiles I read in to the workspace. Now the transformer only allows to "hard code" the value in there.

Any ideas how to solve this? I'm not very familiar with using published/private parameters so maybe those could help? Or should I "manually" create the workflow of random point generation within polygons and ditch the RandomPointGenerator?

1

I have two possibilities to handle this.

The first one is to outsource the random point generation: Create a wrapped workspace that has an own public parameter (number of points to create) and which reads a featureclass with the area features. From here you can call the RandomPointGenerator using the published parameter. Write the result in an new featureclass. Call this wrapper workspace from your original workspace by using the WorkspaceRunner and pass your attribute value to the published parameter of the wrapped workspace and import the newly created “random point featureclass”. This is a little bit complex but it could work.

The second solution is to edit the RandomPointGenerator (please verify if you are allowed to edit due to license restrictions). Edit the RandomPointGenerator transformer by modifying the published parameter NUM_POINTS. Set the Type to Attribute Name. Now you should be able to pass an attribute to the RandomPointGenerator. Please note that this is untested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.