Subscribe to this thread
Home - General / All posts - Clusters with Directionality
atrushwo108 post(s)
#23-May-23 16:46

Morning Everyone,

I'd like to dig up an old post in which Adam provided a brilliant way to cluster lines which touched each other. I would like to use this code on a streamline (watershed lines) network to join lines together. However, I would also like to see directionality added to it by giving it the ability to look downstream. Unfortunately, doing this myself is beyond my own programming abilities. Hence, me asking for help!

My thoughts:

Query 1) This is basically a streamline (watershed lines) network. [ID1] and [ID2] are essentially the [STREAM] and [TARGET] attributes. You can almost skip this step by pointing the script directly at the streamlines.

Script 2) This is the part that needs some rework. Currently each line segment can only be part of one cluster. I would like to see separate clusters for each of the furthest upstream line segments. Thus every resultant line would go all the way downstream to the point of termination. This means that individual line segments would be associated with multiple clusters (except the furthest upstream segment).

Query 3) This query would be the same as it was previously.

I did a simple sketch so people could visualize too!

Thanks in advance.


10,071 post(s)
#23-May-23 22:26

This is a script job, because iterative.

There’s a chance you could do it with SQL, but life is short. (And would it be quicker? No.)

So, if you can provide data, a script could be had. (But probably, given the time involved, should be paid for.)

(I am also looking at Dan, who has already solved this well.)


656 post(s)
#25-May-23 13:55


I have developed an add-in for this. In case you are interested contact me by email (chris dot sloots at gmail dot com). The image below shows exactly one stream (in black) to illustrate the functionality of the add-in.

Schermafbeelding 2023-05-25 155343.png

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.