I have a layer of ~2 million line segments representing rivers, and a layer of ~300 000 line segments representing the coastline. I want to extract the river outlets.
I've tried a bunch of different approaches. It seems like the best way forward is:
- Extract the river segment endpoints to reduce the number of points to consider
- Compute the distance from the endpoints to the coastline
- Discard endpoints that are too far from the coastline, as these are clearly not river outlets
- Of the remaining enpoints, choose (for each river name) the point that is closest to the coastline
The problem is bullet point 2. I've tried the builtin Qgis plugin "distance to nearest hub", but it only gives me distance from points to the coastline segments centroid.
There are a lot or related questions on stackexchange, but I haven't yet found a method that works for this large dataset. I've tried the NNJoin plugin, but it never terminates so it probably does not scale well.
Suggestions for plugins, python code or completely other approaches are welcome!