Question

Random rotation of polygons from a set of anchor points.

  • 27 September 2018
  • 3 replies
  • 1 view

Hello,

I was wondering if there was a way to rotate randomly a set of polygons that each have their own achnor point. This is a GIS workflow using either shapefiles or ArcGIS feature classes in ArcGIS Pro. I was thinking about maybe writing some python code but thoughts that I should try and expand my FME knowledge base apriori.

Cheers,

Simon


3 replies

Userlevel 2
Badge +17

Hi @allasimon, if the coordinates (x, y) of the anchor point are known, the Rotator transformer might help you.

  • Rotation Angle: @rand()*360
  • X Origin: <x-coordinate of the anchor point>
  • Y Origin: <y-coordinate of the anchor point>

The @rand() is an FME math function, which returns a pseudo random number in the range of 0-1.

Badge +2

Hi @allasimon

It sounds like you could use the Rotator to do this. To get a random angle for the rotation you can first use the RandomNumberGenerator with a max value of the 360. In the Rotator you can then use this attribute for the Rotation Angle parameter. The other parameters required are the X and Y value of the each anchor point - if you need to extract these into attributes you can use the CoordinateExtractor.

 

Output:

Hi @hollyatsafe and @takashi thank you both for your responses. I managed to do exactely what I was after. I started with a polygon and a point feature class from an ESRI .gdb. I used ArcGIS pro to write the geometry of the x and y coordinates to the point file table and exported this as a CSV file. Both tables contained a common ID called NestNumber.

I read these layers into FME and used the 'FeatureMerger' to join the attributes of the point table layer to the polygon layer which now contained the coordinates to be used for the anchor points on each polygon feature.

I used the Rotator transformer with the Rand()*360 function and the x and y coordinates supplied by the point table.

Job done!

FYI - this workflow is for a brood survival habitat analysis for a mallard duck study in New Zealand and is used for comparing the brood route buffers to random ones.

Thanks again for your help.

Cheers,

Simon

Reply