Skip to main content

I have a csv of locations points tracking a utility vehicle. Each point is denoted by the "POSITION" number, and they are grouped by a "TRIP" attribute. The LineBuilder transformer will either A) Make a single line connected all points or 😎 if I group by Position it will leave as points.

 

I've done this in Python by using a combination iteration, to use a for loop to connect each point to the one in front of it, but I am unsure what transformers I would use in FME. Additionally, I have yet to figure out how to access and output my features using the PythonCaller.

 

How would I go about connecting each point to the next individually?

@barnard87​  ensure your data is ordered by TRIP, and POSITION (Sorter). Then in the LineBuilder, set the Group By to TRIP. This will break the line whenever the value of TRIP changes.


@barnard87​  ensure your data is ordered by TRIP, and POSITION (Sorter). Then in the LineBuilder, set the Group By to TRIP. This will break the line whenever the value of TRIP changes.

Hello there, thanks for the reply!

 

Unfortunately, this was my first attempt, which resulted in the output of just the point data. Let me try again and look if I missed anything!


@barnard87​  ensure your data is ordered by TRIP, and POSITION (Sorter). Then in the LineBuilder, set the Group By to TRIP. This will break the line whenever the value of TRIP changes.

Hi there. I think the issue was in the phrasing of my question. If trip 7 has 14 points, all with unique position numbers, I still need a continuous line connecting all the positions together (which what you've said will do) , but it makes a single line feature, where I will need multiple line features (Line 1 to 2, 2 to 3, 3 to 4) etc all the way to 14.


Hi there. I think the issue was in the phrasing of my question. If trip 7 has 14 points, all with unique position numbers, I still need a continuous line connecting all the positions together (which what you've said will do) , but it makes a single line feature, where I will need multiple line features (Line 1 to 2, 2 to 3, 3 to 4) etc all the way to 14.

Pass the results from the LineBuilder through a Chopper, with Mode set to 'By Vertex' and Maximum Vertices set to 2. Does this give you the results you want?


@barnard87​ OK with those new requirements you might find that using AttributeCreator and Adjacent Feature Attributes is a faster option. LineBuilder can be slow with a lot of data. The workspace could look something like:

workspaceThe trick is in the AttributeCreator:

transformerYou'll have to add a Sorter if the data isn't ordered correctly by TRIP, and POSITION

 

I've attached the example (FME 202.2)


@barnard87​ OK with those new requirements you might find that using AttributeCreator and Adjacent Feature Attributes is a faster option. LineBuilder can be slow with a lot of data. The workspace could look something like:

workspaceThe trick is in the AttributeCreator:

transformerYou'll have to add a Sorter if the data isn't ordered correctly by TRIP, and POSITION

 

I've attached the example (FME 202.2)

Yes thank you, this adjacent feature attributes option was exactly what I needed to replicate combination iteration as I do in Python. I imagine I will merge the point features, and then draw lines from Position 10 -> Position 10(with _nextX and Y), and so on and so fourth.

 

My only remaining question is how do I specify a value for the last item? Since there is not featurea+1] after it.


Yes thank you, this adjacent feature attributes option was exactly what I needed to replicate combination iteration as I do in Python. I imagine I will merge the point features, and then draw lines from Position 10 -> Position 10(with _nextX and Y), and so on and so fourth.

 

My only remaining question is how do I specify a value for the last item? Since there is not featuree+1] after it.

Actually, I see this created the line's already, I see how it operates now. Still, how would you go about handling the last feature? Potentially if the final point has some data in it that I need, I imagine I would merge any notes as a list attribute


Yes thank you, this adjacent feature attributes option was exactly what I needed to replicate combination iteration as I do in Python. I imagine I will merge the point features, and then draw lines from Position 10 -> Position 10(with _nextX and Y), and so on and so fourth.

 

My only remaining question is how do I specify a value for the last item? Since there is not featuree+1] after it.

If you want to create list attributes containing the data from the start and end point of each line you probably need a different approach e.g.

Capture


Reply