Question

Loop through records and build trace connectivity


Badge +6

Hi I have a table containing 2 columns StartPt and EndPt [see attached].

I would like to find all the connected nodes for each StartPt in the table.

For example, the connected nodes for Startpts 107224 and 100561 are:

 

StartPt EndPt

107224 100561

107224 101420

107224 107197

107224 107196

100561 101420

100561 107197

100561 107196

100561 103058

 

Any suggestion how this can be achieved in FME. Alternatively, I could look at doing this via a stored procedure.

 


13 replies

Badge +1

Hi! If you put an aggregtor and group by StartPt - and put EndPt as for example a string to concatenate (or build a list), that should give you one feature per StartPt, with your set of EndPts either as a list or as a concatenated string. Where will the endpoints go afterwards? That might have an impact on the list-vs-concatednated-string approach.

Badge +6

Hi! If you put an aggregtor and group by StartPt - and put EndPt as for example a string to concatenate (or build a list), that should give you one feature per StartPt, with your set of EndPts either as a list or as a concatenated string. Where will the endpoints go afterwards? That might have an impact on the list-vs-concatednated-string approach.

Thanks for the response. However just the aggregator alone won't work. In the example given , 107224 does not connect to 101420 directly. It only does so via 100561

Seems a bit more involved than it looks.

 

@Takashi Iijima​ , @daveatsafe​  - any ideas ?

Userlevel 2
Badge +17

Hi @sunsilk11​ ,

If you had geometry on the data, the NetworkTopologyCalculator would give you the answer, but in this case I think you may need to use the PythonCaller to code a solution, or perhaps the InlineQuerier if you prefer SQL.

Badge +4

Hi @sunsilk11​ ,

If you had geometry on the data, the NetworkTopologyCalculator would give you the answer, but in this case I think you may need to use the PythonCaller to code a solution, or perhaps the InlineQuerier if you prefer SQL.

Maybe 2x VertexCreator behind each other can build a line and after it the NetworkTopolgyCalculator can identify same Networks?!

Userlevel 5
Badge +29

Maybe 2x VertexCreator behind each other can build a line and after it the NetworkTopolgyCalculator can identify same Networks?!

Create two points one using the StartPt as your X and Y value, and the Second using EndPt as your X and Y value. You can then use a spatialrelater to find which points overlap. You'll then have a list of FIDs (or create a new UUID before making the points) of which are connected

Badge +6

@connecter @daveatsafe​ 

Thank you. I do have the line geometry. However the network is built with the startpt/endpt attributes. NetworkTopologyCalculator does not have the options to use the attributes.

I'll probably go with PythonCaller

Userlevel 1
Badge +10

@connecter @daveatsafe​ 

Thank you. I do have the line geometry. However the network is built with the startpt/endpt attributes. NetworkTopologyCalculator does not have the options to use the attributes.

I'll probably go with PythonCaller

NetworkX is good for this sort of thing if you're going to use python

Badge +6

NetworkX is good for this sort of thing if you're going to use python

Thanks. I am thinking this may be best done outside FME as would probably require nested loops.

Userlevel 1
Badge +10

NetworkX is good for this sort of thing if you're going to use python

It should be quite straightforward if you are able to install the networkx python module. I can post an example later​

Userlevel 1
Badge +10

NetworkX is good for this sort of thing if you're going to use python

Although, I'm not clear why in your example 107224 is not linked to 103058 and beyond as it would appear it goes

Capture

Badge +6

NetworkX is good for this sort of thing if you're going to use python

You are right. 107224 is connected to these 3 nodes too.

Badge +6

NetworkX is good for this sort of thing if you're going to use python

@ebygomm​  Yes you are correct. It was a mistake above. 107224 does link to these 3 nodes too

Userlevel 1
Badge +10

NetworkX is good for this sort of thing if you're going to use python

And 102412 & 107206 ?

Reply