Question

How to filter orientated lines?

  • 3 January 2019
  • 2 replies
  • 14 views

I am dealing with a line dataset that has features that all have different orientations, but all of them are connected to another linear feature.

 

I am looking to change the orientation of the blue lines (photo below) so the orientation end point will be at the red line.

 

The orientor transformer looks to be the best option, but i am not sure how to filter out the lines that the orientation is opposite,

 

Any suggestions?

 

 

 


2 replies

Userlevel 1
Badge +21

I can't see the image in your post. But would suggest looking at the linecombiner, if you extract the original geometry, use a linecombiner to combine touching lines and build a list a direction attribute will be assigned. If you explode the list back to it's part you can rebuild the geometries and use the direction attribute to decide which lines need to go to the orientor

Userlevel 2
Badge +17

Hi @lobsterboy,

The TopologyBuilder transformer will give you the information you need to determine whether the lines should be flipped. Set Propagate All Attributes From Input to Yes and Assume Clean Data to Yes.

The Node output will have the list _node_angle{} on them containing information about the adjoining lines, including all the line attributes. Use a ListElementCounter and a Tester to eliminate the nodes with only a single list entry (end points).

The _node_angle{}.fme_direction attribute records the direction of the line from the node. If the line radiates away from the node, the value will be 'same'. If it runs toward the node, the direction will be 'opposite'. You can use this information to determine the relative orientations of any two connected lines.

The _node_angle{}.fme_arc_id attribute contains a unique id for each line. This id is also placed on the Edge output of the TopologyBuilder, as the attribute _edge_id. After you have tested the nodes to find the edges that need to be flipped, you can use a FeatureMerger to merge this information onto the Edge features, joining fme_arc_id to edge_id. Send the Merged output to the Orientor for flipping.

The LineCombiner may provide a simpler method, but will require testing to ensure it works as desired. Set Advanced - Preserve Orientation set to No and Advanced - Preserve Lines as Path Segments to Yes.

As the combiner creates the Path, it will re-orient the lines so that they match the first line in. You can PathSplitter to split the Path back into its component lines again, but with the orientations aligned.

Reply