Skip to main content
Question

Getting start/end points from polylines

  • October 16, 2013
  • 7 replies
  • 1078 views

Forum|alt.badge.img
I need get the orientation of a line, is that possible? The type of source file is DGN, anybody has idea?

7 replies

Forum|alt.badge.img
  • Author
  • October 16, 2013
I'll like to get  the start point and the end point

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • October 16, 2013
Hi,

 

 

You can use the CoordinateExtractor transformer to retrieve coordinates (x, y, z) of a vertex at specified index. Index 0 indicates start, -1 indicates end. If you need point geometry, the 2D or 3DPointReplacer can be used to create a point based on coordinate values. Alternatively, the Snippter transformer (Snipping Mode: Vertex) can be used to snip a vertex point from the original feature.

 

 

Takashi

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • October 16, 2013
Sorry for a typo; error: Snippter --> correct: Snipper

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • October 17, 2013
Hi,

 

 

Have a look at the PolylineAnalyzer from the FME store, it returns a lot of information about polylines.

 

 

Itay

david_r
Evangelist
  • October 17, 2013
Depending on what you mean by orientation, you could also take a look at the AzimuthCalculator from the FME Store.

 

 

To get the general orientation of a polyline, one way could be to extract the start and end coordinates (see Takashi's suggestion) and then build a single line feature from them using a 2DPpointReplacer with the first coordinate and a 2DPointAdder for the last coordinat before passing it on to the AzimuthCalculator.

 

 

If you need to change the orientation, there is the Orientor transformer.

 

 

David

  • October 17, 2013
The coordinate extractor can extract the start and end coordinates into attributes,

 

Then use the formula:

 

atan((( y_start - y_end)) / ((x_end-x_end)))-90

 

to calculate the heading in degrees

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • October 17, 2013
Hi,

 

 

When you calculate tangent based on coordinates of start / end nodes, be aware that the formula with atan function will raise an error if x_start = x_end (divided by 0).

 

If there could be such a case, consider using atan2 function.

 

 

Takashi

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings