Question

How to get midpoint of midsegment of polyline

  • 21 January 2019
  • 6 replies
  • 59 views

Hi guys. I have set of polylines and i have to create a midpoint on midsegment of polyline. If the polyline has even number of segments it has to go on mid point of one of a two mid segments. Need help, because i cant find solution on my own!


6 replies

Userlevel 4
Badge +30

Hi @martinsutalo

I suggest you to use the transformer CenterPointExtractor.

 

Thanks,

Danilo

 

 

Badge +2

Hi @martinsutalo,

If the CenterPointExtractor doesn't work as you would like because the input data is Polyline I would suggest having a look at the Snipper transformer. You can set the Snipping Mode to Distance (Percentage) and then for the Starting and Ending Location parameters set this to 50. The output should then be the mid point.

Userlevel 4
Badge +30

Hi @martinsutalo,

If the CenterPointExtractor doesn't work as you would like because the input data is Polyline I would suggest having a look at the Snipper transformer. You can set the Snipping Mode to Distance (Percentage) and then for the Starting and Ending Location parameters set this to 50. The output should then be the mid point.

Thanks @hollyatsafe to add your comment in this case!

I tried snipper, it works if polyline has odd number of segments. If polyline has even number of segments snipper will make midpoint in one of the vertexes. In that case i would need point to be on mid point of nearest polyline segment.

Userlevel 4

I tried snipper, it works if polyline has odd number of segments. If polyline has even number of segments snipper will make midpoint in one of the vertexes. In that case i would need point to be on mid point of nearest polyline segment.

Just to clarify, if the point is located on a vertex connecting two segments, then both the neighboring segments are equally close. Or is there another criteria to decide which segment to use?

Userlevel 2
Badge +17

If I understood your requirement correctly, this workflow might help you.

Result:

Reply