Skip to main content

As I am newbie in FME software I’m looking for a help.

I have two sources with lines and I have to point the places where lines are not connected.

Is that possible using some transformers? Please look at screenshots and data I’ve attached.

 

 

 

One way to solve this:

  • LineCombiner to merge all lines. (This is optional, will result in less endpoints but not 100% sure if this improves performance.)
  • Snippers to get enpoints of lines.
  • Matcher to find the not matched points. (Because a single point is the end of a line.)

You could also use a SpatialRelator, line source A = supplier and line source B = requestor or vice versa.

  • Check the box for "Requestor OGC-Intersects Supplier" & "Requestor OGC-Touches Supplier"
  • ..The tool will compare both line data sources with each other
  • The output will contain a column _related_suppliers. If the value is 0 there is no overlap with the other data source
  • Result will be the lines that do not overlap with the lines from the other dataset

If you want to get end point locations of these lines you can continue with the solution from @nielsgerrits 

 

 

 


@nielsgerrits I’ve tried your solution but I stuck at options in these transformers...

LineCombiner - combine on attributes, should I use it in my case?

Snipper - starting location and ending location?

 

With proposal from @lambertus results are strange, not even able to find my example from first screenshots...


@nogger, thanks for your update. I downloaded this morning your zipfile with the data and dived into your lines. Until now it seems like all lines from dataset 1 connect with dataset lines 2. Do you have some id numbers from the column ID so I can check as an example?


Thank you for reply @lambertus 

There is at least one disconnection (I found it manually by viewing the data)

5589afec-52c9-49a5-8dae-ebae5c939e26 from lines1
caf53054-0f84-4cf5-bdac-b185fb27b3ae from lines2


Hi @nogger 

I think I found a solution you are looking for.

Check out the script below. The neighbourfinder is key in this script. Using lines 1 as starting features it checks for each line what are the two closest neighbours in dataset 'Lines 2’. The distances to these neighbours are stored in a list, with some extra steps I saved them in separate columns. 

Be aware that in theory lines can also be connected to just one neighbour and the distance to 2nd neighbour will be large. You can adjust this setting in the Neighbourfinder using the 'Maximum distance’

For now I found 61 lines which are connected to just one line and the distance to the 2nd line is quite small.

Find attached the workbench I created


Thank you @lambertus, I'll check this solution and give my feedback.


Hi @lambertus 

I’ve checked your idea and output looks promising. Bad connections were found, however there are also lines marked as not connected but in reality there are just on a border of searched area and there is nothing wrong with them.

But errors inside road net can be found and that is most important. Thank you!

Screen with pink lines which comes from the output as not connected but in fact they are connected:

 


Hi @nogger, thats sounds good! Do you want me to improve the script or is it fine for now? :)

In case its fine I would really appreciate it if you could set my answer as 'Best answer’ :)

Thanks in advance!


Do you think it can be improved to exclude those border lines?


Hi @nogger, yes I think you can improve the script by some extra steps. In this case using the maximum search distance in the Neighbourfinder will be enough I guess. Based on the average distance of the gaps, by looking at the data in the inspector e.g.,  you can say for example, search within 1m. I expect this will solve your border issues. And otherwise, feel free to ask, I can update the script in that case.


Reply