Skip to main content
Question

connect the dots


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 [(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                

10 replies

takashi
Influencer
  • January 1, 2013
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

davideagle
Contributor
Forum|alt.badge.img+21
  • Contributor
  • January 2, 2013
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

redgeographics
Celebrity
Forum|alt.badge.img+49
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.

philippeb
Enthusiast
Forum|alt.badge.img+20
  • Enthusiast
  • February 25, 2013
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!

philippeb
Enthusiast
Forum|alt.badge.img+20
  • Enthusiast
  • February 26, 2013
OK nevermind... it's the firewal that was blocking me.

 

Thank you for the workbench!!

  • July 20, 2014
Hi,

 

 

I have a series of X,Y points from a SQL query. How do I join them all into a line?

 

Thanks

Forum|alt.badge.img
  • November 16, 2017
takashi wrote:
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 @takashi,

 

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!

 


takashi
Influencer
  • November 16, 2017
takashi wrote:
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).

Forum|alt.badge.img
  • November 16, 2017
takashi wrote:
Hi @judychang, I think you can decompose the whole line into individual segments with the Chopper transformer (Mode: Vertex, Maximum Vertices: 2).
Thanks that worked!

 

 


david_r
Celebrity
  • November 16, 2017
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.

 


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