I need to connect a stream of consecutive input points into a series 2-point line segments. I need to retain the attributes of each point. This seems like an easy problem, yet I cannot find an efficient way to do it. PointConnector wants a "break" attribute, which causes a new segment to start at the "breaking" point, not at the previous point. 1 2 3 4 ... to infinity and beyond X X X X ... I need segments n(1,2),(2,3),(3,4)] I'm about to write a python script to do it, but it seems like it should be a simple enough pattern to be able to do with transformers. --Brad
Page 1 / 1
Hi,
2 Counters, a Sorter and a PointConnector might help you.
I put a sample workspace here.
https://www.dropbox.com/s/v0prq492d4kg70y/130101ConnectDots.fmw
Hi Brad, Takashi provides a very elegant solution. To complete it and retain the attributes from the input points though you'll need to add a List Name to the PointConnector. This will effectively generate an array of values containing all the input attributes from the two points that makes up each of your lines. You can then do what you want with this list using the Transformers you'll find in the Transformer Gallery under the 'List' category.
Hope that helps, Dave
A less elegant solution:
Use a PointConnector without setting a connection break attribute to connect all points to eachother. Then a Chopper with max vertices set to 2 to turn that into the line segments you're after and a PointOnLineOverlayer to overlay the original points on the line segments. If you set a list name there it'll create a list with all the point attributes of the 2 points overlapping the line segment.
Hope this helps.
Hi Takashi
I have the same problem, but I can not download your FMW. Would it be possible for you to put it back?
Thank you!
OK nevermind... it's the firewal that was blocking me.
Thank you for the workbench!!
Hi,
I have a series of X,Y points from a SQL query. How do I join them all into a line?
Thanks
Hi,
2 Counters, a Sorter and a PointConnector might help you.
I put a sample workspace here.
https://www.dropbox.com/s/v0prq492d4kg70y/130101ConnectDots.fmw
Thanks for the workbench. I'm doing something similar - but I have points in different groups. Is there a way to do that? They all originate from the same point but end up in different points. So I'd like for example 0-1-2-3-4-A , 0-1-2-3-B , 0-1-2-3-4-C etc. Right now I use the the destination point as the break attribute and I clone the point "0" and sort the 1 2 3 4 on the way so I only get the whole line of 0-A, 0-B, 0-C but would like segments too.
Thanks!
Hi,
2 Counters, a Sorter and a PointConnector might help you.
I put a sample workspace here.
https://www.dropbox.com/s/v0prq492d4kg70y/130101ConnectDots.fmw
Hi @judychang, I think you can decompose the whole line into individual segments with the Chopper transformer (Mode: Vertex, Maximum Vertices: 2).
Hi @amite, I recommend you post your question separately, it will make it easier for us to help. I also recommend that you attach some sample data or some screenshots.