Subscribe to this thread
Home - General / All posts - Utility Network Distance
mantle31 post(s)
#18-Jun-15 11:46

Hi

I am looking for a method that would allow me to calculate the cumulative length of all line segments along a utility network route between service point and all consumers along the network.

Has anyone tried this before?

I have atteched an example image to illustrate what I mean

Thanks

Attachments:
Network_example.jpg

adamw


10,447 post(s)
#18-Jun-15 14:40

If I understand you correctly, you need to (a) for each consumer location, select lines on the shortest path from the service point to the consumer, and merge all such selections into one, then (b) sum the lengths of lines in the final selection.

The former is best done using a script - you could do it manually (set the select mode to Select Add, clear the selection, add all lines to the selection, add the service point to the selection, add one of the consumers to the selection, do Select Shortest Path transform, add the result to a saved selection or set some field value in the selected lines so that you can find these lines later, repeat with the next consumer), but if the yellow dots on the image represent consumers, their number looks too big for this to be pleasant.

The latter is a simple viewbot (Selection - Length (I) - Sum), or a query (SELECT Sum(...) FROM ...).

mantle31 post(s)
#18-Jun-15 15:30

Hi Adam.

Thanks for your reply, if only it was that simple.

Each of the round point on the network are distribution units, they serve a number of customers so the key attribute point is "No_Active_Customers"

The Blue Square is a High Voltage Supply.

So I want to attribute each segment of line with to total amount of downstream customers for that segment.

The segments closest to the High Voltage supply will have the largest number of downstream customers and this will reduce as wwe travel along the network.

Any Thoughts?

tjhb
10,094 post(s)
#18-Jun-15 17:39

Are the loops real loops or only apparent? How do theyvaffect the meaning of "downstream"?

tjhb
10,094 post(s)
#18-Jun-15 17:52

If you have a topology already (from and to attributes for each section of line, and assuming no actual loops) then you can use a stack to walk the network from leaf sections (those with an empty to attribute) back to the root section (empty from attribute), at each point adding the adjacent customer count for the section, then pushing each from section and the current sum to the stack. Then pop and repeat until the stack is empty.

mantle31 post(s)
#18-Jun-15 18:02

Hi, tjhb.

I have topology (from and to attributes for each section of line) and no actual loops.

I have limited programming skills, do you know of any examples on here that could get me kicked off?

tjhb
10,094 post(s)
#18-Jun-15 18:19

That's excellent. I could have a go in IronPython, if you can give some sample data? I don't know of any close examples here.

mantle31 post(s)
#18-Jun-15 19:00

That would be much apprecieted.

I have attached some sample data. A few points worth noting are that this is part of a much larger dataset so will probably not get an empty from field to identify the root section. even the parts of the network that appear to end join into a different voltage network, but I am not interested in that data.

Thanks

Attachments:
SampleData.map

tjhb
10,094 post(s)
#19-Jun-15 01:59

It doesn't look as if the necessary topology attributes are included yet.

In drawing NETWORK, the line with SEG_ID 2273500 (to take one example) flows from the line with SEG_ID 2273497, and flows to two lines, having SEG_ID 2273666 and SEG_ID 501312736.

Its topology attributes are FROM_SEG 2273498 and TO_SEG 2273504.

Are FROM_SEG and TO_SEG node IDs? That doesn't really seem to make sense either (and there are no node points in the project).

What am I missing?

tjhb
10,094 post(s)
#20-Jun-15 00:29

What would be required for this approach is topology attributes storing FROM_NODE and TO_NODE for each section of line.

(I could add these myself but would rather they came in the sample data.)

tjhb
10,094 post(s)
#19-Jun-15 05:56

Really keen to get a version of this data I can work with.

volker

1,086 post(s)
#18-Jun-15 20:10

have you looked at "Optimal Route" (but you must have Business Tools).

Took all Drawings in one Drawing select 2 points and go to Optimal Route. After this copy the selction in a new Drawing and with View Bots you can calculate the Lenght (I):


http://www.thegisservicesector.de

mantle31 post(s)
#18-Jun-15 22:54

Hi Volker,

Thanks but I need something that is scallable as I have to cover 42,000kms of newtork and over 7,000 points

I tried that using adamw's solution of using Select Shortest Path from the transform tools.

This doesnt require Buisness Tools but I just dont like te idea of running it over 7,000 times.

Thanks

artlembo


3,400 post(s)
#19-Jun-15 03:52

I just dont like te idea of running it over 7,000 times

Have you thought about scripting it? That shouldn't be bad - you would simply use the Analyzer object in a for loop. There is an example of how to do that in the gisadvisor.com training video for VBScript. It's only a few lines of code.

tjhb
10,094 post(s)
#19-Jun-15 04:02

It would still be slow though Art.

Here, if* topology information is already encoded in attributes, walking the network tree becomes a matter of matching known IDs, very cheap. We don't need to concern ourselves with geometry** or graph algorithms since that's done.

*Not clear yet. See earlier post.

**Except for counting the number of transformer stations lying on a section of line. But that is also cheap.

mantle31 post(s)
#19-Jun-15 10:15

Art,

Im not sure that the results of the viewbots would be reuseable?

adamw


10,447 post(s)
#19-Jun-15 13:59

Since you say you want to count the total amount of downstream customers for each segment, the procedure would be slightly different from what I posted, ie - create an integer field for the segments, set it to 0, then for each customer, do Select Shortest Path, and increment the value of the field for the selected segments (by the value of "No_Active_Customers"). No need to use viewbots, the results will be in the field. Since there are 7000 customers, this is best done using a script. If the performance of the script is a problem - it might be or it might not - there are ways to make it faster, eg, tjhb suggests a start of one such way.

tjhb
10,094 post(s)
#20-Jun-15 00:46

A potential problem using Select Shortest Path (see attachment).

This network, when viewed strictly in two dimensions, does contain loops. (And those intersections which appear in two dimensions but are not intersections in 3D space, quite rightly do not have nodes.)

In the attached example we don't get the desired path. It is correct given the usual assumptions, but not the desired path given the actual nature of this network.

So I think that for this network, Select Shortest Path must probably be set aside in favour of a method starting from stored topology.

A shame if that's true because Select Shortest Path is amazingly fast code.

Attachments:
Example.png

mantle31 post(s)
#22-Jun-15 15:44

I am happy to persue which ever method you recommend.

tjhb
10,094 post(s)
#22-Jun-15 18:44

Then can you have another look at the sample data? See posts above. You may have missed them.

mantle31 post(s)
#23-Jun-15 10:32

Hi, tjhb.

I see what you mean, the topology information in data that we have received has turned out to be unreliable.

Is there a way that I could create this topology information?

Regards

tjhb
10,094 post(s)
#23-Jun-15 23:42

Yes, though it may be slightly tricky. However I'm a bit concerned for your sake about things not being quite the way they should be.

Have you already paid someone to set the topology information? If so, and they did it wrongly, maybe it would be best to go back to them? If your client supplied the topology data, well, that may be more difficult (but they should probably at least know).

The reason applying topology with this data is the two-dimensional line intersections which are not, in fact, network nodes, because although the lines cross in 2D they are not connected at the crossing point. (The same factor gives rise to the apparent loops, which are not actual loops in the physical network.)

This needs special handling. In the normal case it would be easy: you would (if necessary) run Normalize Topology over the network to ensure that all line intersections were at an exactly shared vertex. (You'd actually do this on a copy of the network, since Normalize Topology changes line direction.) Then you'd use the Node Points transform to draw a point at each intersection and at each free line end. Then assign a unique ID to each node point. Then use SQL (probably) to write the FROM_NODE (ID) and TO_NODE (ID) for the start and end of each network line (section, or branch).

But that first step could be a problem here, since it would add intersections where lines only appear to cross, without intersecting in the physical network. Node Points would then add points at these non-intersections, so to speak, giving false connectivity.

So this network requires special handling. It wouldn't be too hard to find the actual nodes in SQL, at least if we can assume that it is already correctly normalized, so that any intersection where vertices are exactly shared are true network intersections, and not otherwise. (I don't know if that is the case.)

I'm happy to try to help with this, but (1) if you've already paid for this to be done, and it hasn't been done properly, then that might be your best approach; and (2) I'd personally only want to help if I could have access to the whole dataset. It might be something you'd prefer to deal with outside the forum.

I hope I'm not overcomplicating things. It would be easy to tell you how to shoot yourself in the foot.

mantle31 post(s)
#24-Jun-15 19:40

Hi tjhb,

I have sent you an email in relation to this.

tjhb
10,094 post(s)
#24-Jun-15 22:16

Thanks, got it.

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