I am new to ESRI products (I typically use QGIS), but am using it in order to analyze upstream/downstream flowlines with the National Hydrography Dataset (specifically, HUC-4 mapping units for NHDPLUS HD data). In particular, I am hoping to select all upstream and then downstream flowlines from a polygon layer. An example might be - what are the upstream flowlines that flow into this state park? It seems like the only way to do this is the trace upstream flow accumulation by point (by dropping a flag). This will be prohibitively cumbersome to try and drop a flag at all of the points the polygon boundary intersects with NHD flowlines.

Is there a way to set the starting point from the polygon object itself? I have state parks in one layer, and NHD flowlines in another. My ultimate goal is to be able to identify upstream/downstream monitoring stations (which is a point layer of water quality monitoring stations).

3 Answers 3


You can use the TraceGeometric network tool that powers the utility network analyst tools. It can use a point feature class instead of hand placed flags to get your locations.


You could probably clip your NHD layer by state park polygons and then place points at the ends of NHD linework to get the pour point locations for the trace tool. But that may require a bit of scripting. As long as you can get the points where the streams intersetct the polygons the TraceGeometricNetwork tool should work just fine.


I ended up running the following process, although it was time consuming (so if someone has a better way, that's great!). In case others run into this issue again, I intersected NHD flowlines with my polygon, and saved the output as points. I then imported that points layer to the network as an "event" using the HEM tool (Hydro Event Manager by the EPA), and then was able to select is as a points starting layer for the Trace Geometric Network tool.

The only complication is that the result of the trace upstream algorithm is selected flowlines from the NHD network. They do not indicate which starting flag they come from (and some start from multiple starting flags). It was impossible (as far as I could tell) to denote which polygon they were upstream from when running several at once. So, I had to do this one polygon at a time (and, due to what data from NHD is available with a populated flow table, I did this to the polygon-HUC4 level). So I had a separate selected output for each polygon in each HUC4 area it was in, and could accurately denote where the flowlines were upstream/downstream from. It was brutal!


It might be a more suitable solution to store an attribute in your flow network to signify that it flows into said polygon. You could store the name of the National park for example, or Null when it doesn't intersect. eg: Field name called 'National Park Name' (To identify the National Park attribute, just run a quick analysis - If line intersects national park polygon, population line.national_park_name to equal the polygons National park name. It may help to dissolve the flow lines that are 'within' a polygon.)

Then simply run a predicate/filter query to identify flow lines where National Park Name does not equal Null. This will give you a set of lines to start from as a set/collection/vector/array which will be lines inside National park (ie: Your starting points). PS - Im assuming ESRI's Network trace can start from linear features? If not, maybe get start node of linear feature.

Then for each item in your linework collection set, loop over each line, run your network trace 'out', return all upstream linework,, plus the National Park name of the starting line. Ultimately, returning a trace which would intersect your monitoring stations. (National Park XYZ inflow is monitored by Monitoring station Joe Bloggs). (im also assuming you are able to batch these up and run via a small Python script that loops over the set or similar).

Also - excuse my nomenclature/naming conventions of data structures, I jump around systems so much and work on different languages that I forget the naming conventions of low level things in each system.

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.