Question

Splitting lines at angles

  • 17 November 2017
  • 2 replies
  • 17 views

Hey,

I am very new to FME, I have a problem I thought I may can solve easy with FME, but I am stucked, so I hope someone can help me.

I have a curb dataset and I need to cut it at every street intersection so that every street is feature.

First I thought about calculating the angles between the lines with the Polyline Analyzer, so I have the Information where the line bends, and I can cut it at the node or delete all segements with those nodes. Unfortunately it only gives me the angles of segment nodes, not of all nodes. I tried to aggregate the Dataset, but then it would take hours, even for my test dataset with "only" 15000 nodes ( total dataset has app. 10 000 000 nodes).

My second thought was to cut the lines at their max and min points wich should be possible to calculate somehow, but I did not find out how so far. Any suggestions?

Another approach would be to sharpen the ends, so that they are no curves in the lines, then I guess it would be easier to cut the lines at the correct point. I found a lot of tools to smooth the lines, but is there something the other way round? Generalizer does not do the expected thing.

3rd approach was the one you see in the picture, explode all lines and delete all small lines, in this example I deletet all lines wich are smaller than 30cm. With this way there are two problems: There are gaps between lines where there shouldn't be. And there are some curves where the lines are >0.30m. So guess I can increase the distance up to 1m but than I need to connect those lines which should not be separeted! As within curves there are at least 2 or more lines, it should then connect only the gabs we wanted. Anyway this might be the dirtiest way!

Is there someone who had a similar problem and can help me?

I hope I described my problem clearly, if you have any questions please tell me so.


2 replies

Badge +1

Hi @magdalenakoubek,

I think the PolylineAnalizer is the way to go to tackle this issue.

What I would do is:

- add a unique id to each line

- Use the polylineanalyzer to calculate the angle between the individual segments in your line (use the 'Segment' output port to get segments of 2 coordinates each).

- Group the segments per angle value (create an 'angle group' attribute). This post might help you do this:

https://knowledge.safe.com/questions/47675/group-records-based-on-attribute-values.html

- Recreate the original lines per line_id and angle group using the linejoiner transformer ('group by' the unique ID of your line and the angle-group that you defined in your previous step).

Userlevel 4

Maybe the HullReplacer can help you "square" the corners on some of your geometries.

Reply