Skip to main content

Hi

I have two points inside a polygon and want to split the polygon in two based on the location of the points.

So far, I have created a line between the two points in order to find the centre point.

I want to create a new line, which runs through the centre point and are orthogonal with the line I created between the two original points. Then I can split the polygon with the new line.

Can anyone help me with this?

Hi @stihe, a possible way is:

  1. Extract coordinates of the center of the original line with the CenterPointExtractor.
  2. Rotate the original line around the center coordinates by 90 degrees with the Rotator.
  3. If necessary, extend the rotated line with the Extender.

1. Counter on lines (to make ID of them)

2. CenterPointReplacer on lines - this will convert lines to points,

3. CoordinateExtractor on points this will create _x,_y coordinates for rotation of lines

4. FeatureMerger: Requestor are lines (connection from Counter), supplier are points (connection from CoordinateExtractor), merge by ID. This will fill lines with attributes (_x,_y) from points

5. Rotator, angle=90, X Origin = _x coordinate, Y Origin = _y coordinate. This will rotate lines by 90 degrees based on midpoint

6. Scaler, deliberately scale line by 5-6 (or 100) so you can cut polygon

7. Clipper, clip polygon with its line (optionally using Group by parameter)

Cheers


Thanks, Takashi!

It works like a charm.


1. Counter on lines (to make ID of them)

2. CenterPointReplacer on lines - this will convert lines to points,

3. CoordinateExtractor on points this will create _x,_y coordinates for rotation of lines

4. FeatureMerger: Requestor are lines (connection from Counter), supplier are points (connection from CoordinateExtractor), merge by ID. This will fill lines with attributes (_x,_y) from points

5. Rotator, angle=90, X Origin = _x coordinate, Y Origin = _y coordinate. This will rotate lines by 90 degrees based on midpoint

6. Scaler, deliberately scale line by 5-6 (or 100) so you can cut polygon

7. Clipper, clip polygon with its line (optionally using Group by parameter)

Cheers

Which is basically what Takashi said :D

 

 


Thanks, zzupljanin. I wasn't aware of the Scaler. It could be useful.


Reply