Skip to main content

Dear FME community,

this is probably an easy one but how can I access the total number of coordinates of a line feature? It is displayed in the Inspector, but how can I get the information?

I want to extract the coordinate which is in the center of a poly line for further processing.

Kind regards

Thomas

Use the CoordinateCounter transformer or use the function @NumCoords() in AttributeCreator or AttributeManager in 2016.


Use the CoordinateCounter transformer or use the function @NumCoords() in AttributeCreator or AttributeManager in 2016.

Many thanks Mark! Sometimes one is blind for the obvious things :)

Have a nice weekend!

Thomas


Hi Thomas,

Maybe off-topic, but calculating the number of vertices might not get you the center of the line if the number of vertices at the start or end is dense.

To get the vertex closest to the center you want to try this:

Chop the line to points using the Chopper keeping the ID.

And replace the line by a center point using the CenterPointReplacer also keeping the ID.

Find the vertex closest to the center of the line using the NeighborFinder (group by ID).

Hope this helps.


Hi Thomas,

Maybe off-topic, but calculating the number of vertices might not get you the center of the line if the number of vertices at the start or end is dense.

To get the vertex closest to the center you want to try this:

Chop the line to points using the Chopper keeping the ID.

And replace the line by a center point using the CenterPointReplacer also keeping the ID.

Find the vertex closest to the center of the line using the NeighborFinder (group by ID).

Hope this helps.

Good point. Thank you! I will try it with the mentioned transformers.


Try using a snipper set to by percentage 50 as a start 100 as finish

use co-ordinate extractor with an index of 0 to give you the co-ordinates at the centre

create a point using the _x an _y


Try using a snipper set to by percentage 50 as a start 100 as finish

use co-ordinate extractor with an index of 0 to give you the co-ordinates at the centre

create a point using the _x an _y

The solution with the snipper sounds just perfect! I will try it. Many thanks!


Try Snipper with percentage Start = 50 and End = 50 - no need for CoordinateExtractor.


Try using a snipper set to by percentage 50 as a start 100 as finish

use co-ordinate extractor with an index of 0 to give you the co-ordinates at the centre

create a point using the _x an _y

Try Snipper with percentage Start = 50 and End = 50 - no need for CoordinateExtractor.


Try Snipper with percentage Start = 50 and End = 50 - no need for CoordinateExtractor.

Thank you guys! Using the snipper with a setting mode "Distance (Percentage)" and a start/end location of 50 works wonderfull! For every line it creates a point geometry which I can use as the center of the line. This is what I was looking for.

@mark: Unfortunately, I cannot "accept" your answer as correct in the forum, but it did the trick :)


Reply