I have three shapefiles which represent a conduit network with valves and hydrants. The pipe grid consists of line features in a shapefile and the valves and hydrant each are a point layer in a shapefile.

enter image description here

For the planning of flushing proceedings I need to select some of the pipe elements (the line features) in a certain order which are to be flushed. The underlying attribute table of the pipe elements is also important for the planning process.

Ideally there is a way to create many different flushing selections (e.g. pipe no. 1-5, pipe no. 18-45, etc.) and save them in another layer, let's call it flushings. It is essential that the selection of pipes is assigned a new identifier the flushing ID.

So the flushing layer would contain flushing no. 1,2,3... with each flushing itself containing or refering to a previos made selection of pipe elements. I then would like to export the generated information of a pipe selection and an assigned flushing ID to either a shapefile or any other way which I can use in my PostGIS database.


pipe elements attribute table:

id  material  diameter
1   PE        80
2   PE        80
3   PE        100
4   PE        100

I need something like this in my database:


flushing_id   pipe_id  order
f1            2        1
f1            3        2
f1            4        3
f2            1        1
f2            2        2
f2            3        3

Is there an easy workflow for pipe selection and assigning a flushing id to the selection to import it in a database later? It would also be helpful if each selection could be colored differently to make it easier to work with.

  • 1
    this is quite an extensive question, and seems to be coupled with some misconceptions (no offense); since you plan to work with PostGIS, I strongly recommend to use the DB as the actual data backend instead (i.e. have your base layers imported and do the 'network' analysis and selection in PostGIS)...that's what it's for. on what criteria do you need to select those flushing clusters? topology (e.g. connectivity)? given such a cluster order, that can be processed algorithmically, it's easy to automatically assign f_ids and select per that category (and later color accordingly in QGIS). – geozelot Aug 13 '18 at 10:52
  • Thank you for your answer. I already imported the 3 layers into my PostGIS DB. I hoped there was an easier workaround for selecting pipe elements and assigning a flushing id to it. The way you described it it seems I have to build a GIS like application to display the geographic information of the pipegrid and make my selection. The way the selected pipes are choosen for flushing is my an engineer manually regarding different criteria (in attribute table). I thought there was a way to use QGIS functionality for user friendly pipe selection instead of building a whole new app from scratch. – user126473 Aug 13 '18 at 11:06
  • it's really just about how you define a flushing (i.e. collection of pipes); e.g. from intersection to intersection? 'downstream' from a start node, with branches? or manually select pipe id ranges? or what? once that is settled, it's as easy as it gets... – geozelot Aug 13 '18 at 11:17
  • yes the selection is done manually by choosing a flushing path along the grid which makes sense to the engineer (considering total length, surrounding pipes etc.) there is no strict rule to it. The pupose of my question is how to select some graphically displayed pipes and add them to a group by assigning a unique identifier (flushing id) to it. It is then to be stored in the DB (e.g. by exporting it in a .shp-file) for further processing (link to field data for that flushing id etc.). All I really need from QGIS is this graphical selection done manually in an easy workflow. – user126473 Aug 13 '18 at 12:15

The workflow in vanilla QGIS would probably be something like this:

  • Set up your attribute tables as you have done - with pipeIDs, with two new columns flushing_id and ord (I would avoid using order as that is a database keywork)
  • Manually click on each point in turn, and assign it a new flushing_id and ord manually, record by record, saving as you go.

The only possible improvement to this would to to write a script / add-in in QGIS that could speed this up, for instance by recording the order of selection of points, and writing them out automatically in that order to the database.

The issue with the workflow you have described is there is not generally a mechanism in GIS for recording the order of selection - the selection will remain in the order of the original table when you export it out or do anything with it, so you will probably have to write something custom - I haven't seen a tool that will do that or could be adapted to do that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy