I have an ordered stream network and I want to select all stream features that contain water that has come from a certain area. To start with I'm running a select by location query to find all stream segments that cross my polygon. The problem is that this does not select the stream segments further down stream that these segments flow into.

What I need to do is create a selection that will select stream segments that touch existing selected segments only if they have a higher number for the stream order attribute, then repeat this until the result does not change. I expect I have to do this in python, but I'm not sure of a few things: how to use the select by location and select by attribute at the same time (select intersecting lines that have a value above a threshold), how to make the threshold relate to the line you're checking the intersection with (select intersecting lines that have a higher value than the line they're intersecting with, how to get this to iterate through until the selection isn't changing.

This feel quite complicated, but I'm sure people will have run into this problem before so there might even be an easier way, or a tool. Is there?

This image is a manual section that shows what I'm trying to achieve - I want to select the streams that start in the green area and everything they flow into.enter image description here

  • Or maybe I can use the flow raster and only select down stream segments? – whatahitson Oct 19 '15 at 12:57
  • Are the streams digitized in a downstream order (like the NHD dataset)? I was involved in a project that did something similar identifying every landcover type that a stream passed through on a downstream course. – jbchurchill Oct 19 '15 at 14:04
  • @jbchurchill theyre not digitised, theyre calculated from my DEM. Are you referring to the direction of the polyline? I've just checked and they're all pointing uphill (obviously consistency is the important thing - I can flip them). It sounds like this is one step simpler - if as if I just need to identify which streams have passed through a certain land use type. – whatahitson Oct 19 '15 at 14:15
  • Your image does not match your description. Taking the top "selected" line it starts as 1st order, will become 2nd order immediately below that vertical straight tributary and will stay 2nd all the way down to the left. You asked about keep selecting whilst the downstream segment is a higher order. So going by description you would have had a very short section selected in the top example, Is this correct? – Hornbydd Oct 19 '15 at 15:14
  • @Hornbydd Well spoted, that means using the order wouldn't help me. What I'm trying to do is what I've got in the picture. I think using the start and endpoints as jbchurchill has suggested is the right track. – whatahitson Oct 19 '15 at 15:19

If your polylines are consistently digitized (or otherwise created in your case) in one direction (downstream or upstream). You can use the Feature Vertices to Points tool to create a point layer representing start points or end points. So what you do with this is ...

  1. Intersect the polylines with the polygons (can use this to identify some feature of the polygon or ignore this extra bit of information).
  2. Create start points and then create end points (I believe you may want separate layers to make it easier to do the selections).
  3. Select [By Location] end points that intersect polygons.
  4. Use selected end points to select polylines (again by location).

If your polygons and polylines don't intersect multiple times, then this may get you where you need to be, but if not you can continue selections (we did this with a loop in python) using a series of "Select By Location" operations going from Start Points to End Points. This allowed us to go down from the polygons but never include anything inside or upstream. Give this a try. If I skipped a step, let me know where you run into problems and I'll look more closely at the script and revise as necessary.

  • thanks, I think I'm most of the way there, but I'm slightly lost in terms of how to select the polylines, I suppose its an attribute that links them to the ponits because I cant intersect on endpoint only. I've got my start points, end points and lines. I can start with by selecting start points by location intersecting polygons, then I can select polylines... can I use the object ID here? select polylines where FID in ([list of FIDs])? How do I do this, do I need to write the selected FIDs to a list? – whatahitson Oct 19 '15 at 15:07

Your Answer

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

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