I have a table of rivers in PostGIS, each river linking to its outflow. I also have a QGIS layer of some selected sources, and would like to select the entire river downwards from each source (i.e. find the closest segment to each point, then recurse through the outflow links until hitting the ocean).
Is there a way to do this interactively? I'd like to just update the point layer and have the query use these points. I don't think QGIS offers any help with that (parametrized queries?), but I could store the point layer as a shapefile, load that as a temporary table and use that in my query.
is there a way to load a shapefile in a subquery? I don't want to use
shp2pgsqlmanually, but load the current version of the file each time the query is run.
can I maybe somehow trigger actions in QGIS when a layer has been edited? i.e. update the river layer when the point layer has been saved with the new query output, or, alternatively, run a script that loads the point data, runs the query, dumps its data into a shapefile, loads that in QGIS and refreshes the view?