1

I have pipeline network by shapefile, I want to get junctions and it must have link with pipes to run Epanet (id's junctions must have in node1 and node2 of pipeline). I know that we can extract point from line, but these point seems don't link with line. Is there way to get it? By Python, or tool?

1 Answer 1

1

I once generated a partial EPANet input file from a pipes layer in MapInfo so I understand a bit about what you need. Pipes are defined in one section of the input file with the data: length, diameter, unique pipe id, start node and end node. The nodes (called junctions) are defined in another section of the input file with the data: elevation, demand and unique node id. We need to generate the nodes data from the pipes layer.

Here's one way to do it:

  1. From the Processing Toolbox select the "Extract specific vertices" algorithm. Select the pipes layer as the input layer and enter 0,-1 for the vertex indices. 0 will extract the start point of each line and -1 will extract the end points. This will create a temporary layer named Vertices.enter image description here

  2. The Vertices layer from step 1 will contain twice as many objects as the pipe layer. There will be multiple points with the same coordinates where the ends of the pipes meet. Use the "Delete duplicate geometries" algorithm on the Vertices layer to get a single node at each location. This will create a temporary layer named Cleaned.enter image description here

  3. Now you have a point for each Junction, you need to assign unique ids. Use the "Add autoincremental field" algorithm. I chose "JunctionId" as the name of the field and a starting value of "1". This will output a temporary layer named Incremented. Rename the layer to Junctions.
    This layer can be the starting point for the Junctions section of your EPANet input file. At this stage it really only contains the Junction Id (and a lot of superfluous columns as a result of the various algorithms), you'll have to sort out the demand and elevation.enter image description here

  4. Now that you have the Junctions you need to add the start node and end node to the pipes layer. Use the Field Calculator to add two columns containing the ids of the Junctions which intersect the start point and end point of each pipe. The expression for the start node will be:
    aggregate(layer:='Junctions', aggregate:='max', expression:="JunctionId", filter:=intersects( $geometry, start_point( geometry(@parent))))
    and for the end node:
    aggregate(layer:='Junctions', aggregate:='max', expression:="JunctionId", filter:=intersects( $geometry, end_point( geometry(@parent))))enter image description here

That should get you some way along the path to a working EPANet model. Good luck. enter image description here

1
  • M Bain I got your idea, it's helpful with me, many thanks
    – Users A
    Sep 15, 2019 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.