I need get the orientation of a line, is that possible? The type of source file is DGN, anybody has idea?
Page 1 / 1
I'll like to get the start point and the end point
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
Sorry for a typo; error: Snippter --> correct: Snipper
Hi,
Have a look at the PolylineAnalyzer from the FME store, it returns a lot of information about polylines.
Itay
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
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
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