<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: identify the nearest gages downstream from dams in Water Resources Questions</title>
    <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306412#M1434</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you should be able to do this without python.&amp;nbsp; I think it is quite simple once you figure out how to add all of the flags and barriers at one time.&amp;nbsp; I think if you select all of the dams there is an option to add then all as flags, then you can do the same with gauges as barriers.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table for the output lines should have a should have a field with the OID (or FID) for the dam and the OID (or FID) for the associated gauge.&amp;nbsp; You may need to fiddle with analysis setting so it only find the first (closest) barrier.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 15:40:02 GMT</pubDate>
    <dc:creator>BillDaigle</dc:creator>
    <dc:date>2016-06-15T15:40:02Z</dc:date>
    <item>
      <title>identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306409#M1431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Help please:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Task:&lt;/STRONG&gt; identify the nearest gages downstream from dams&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;Data:&lt;/STRONG&gt; Stream Flowline (line feature class), streamgage point feature class, dam point feature class (both point feature classes contain thousands of points)&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;What I did: &lt;/STRONG&gt;Using geometric network analysis tools to first create a geometric network, then set flow direction and finally trace geometric network, I got the output of a group layer.&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;My questions:&lt;/STRONG&gt; I am hoping to add a new field which contains the ID of the nearest gage point for each dam point in my dam point attribute table, is that possible to realize this using the output of tracing geometric network? How can I realize it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maggie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 14:55:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306409#M1431</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-15T14:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306410#M1432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Been a while since I have done this.&amp;nbsp; It is certainly possible.&amp;nbsp; Conceptually, you will want to add all of your dams as flags (starting points) and gauges as barriers (end points). When you run the analysis, you will get an output of lines for each set of start and end points.&amp;nbsp; I believe you can join the line output back to the dam feature class if you want to populate the downstream gauge id.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:14:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306410#M1432</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-15T15:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306411#M1433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for your reply Bill! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you mean to join the line output with the original dam feature class? How can I get the closest downstream gauge id and add it to dam's attribute table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you've done this to identify the nearest downstream points for many upstream points in one time and we don't need to use python to automate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:27:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306411#M1433</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-15T15:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306412#M1434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you should be able to do this without python.&amp;nbsp; I think it is quite simple once you figure out how to add all of the flags and barriers at one time.&amp;nbsp; I think if you select all of the dams there is an option to add then all as flags, then you can do the same with gauges as barriers.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table for the output lines should have a should have a field with the OID (or FID) for the dam and the OID (or FID) for the associated gauge.&amp;nbsp; You may need to fiddle with analysis setting so it only find the first (closest) barrier.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306412#M1434</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-15T15:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306413#M1435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I am able to select all of the dams points and gauges points with tracing geometric network tool. Do you mean all the information are contained in the output lines attribution table, including the ID(OID or FID) of dams as well as gauges? The computer I am using now has no ArcMap, I will try later. Can I ask you if I have further questions later? Thank you so much Bill!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:55:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306413#M1435</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-15T15:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306414#M1436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the info you’ll need should be in the attribution table.  I will do what I can to help.  I haven’t done it in a while.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 15:57:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306414#M1436</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-15T15:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306415#M1437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bill, I use "trace geometric network" tool and set the dam points as flags, the gage points as barriers, I also disable gage point feature class so that it will stop trace when there is gage point. Then I limit the results to features stopping the trace. The output I get are the layers with selection features. Then I create layers from the selected features for both dam and gage point feature classes. But from the result I don't know which gage point are paired with dam point(nearest along the streamline) and what should I do next so that the nearest ID of gage point can appear in dam point attribution table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please recall which tools you used to realize the task? Is there any record available as my reference? May I write email to you or call you directly if possible? Thank you so much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maggie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 21:27:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306415#M1437</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-16T21:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306416#M1438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Maggie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now it’s coming back to me.  It’s the network analyst toolset (instead of the geometric network tools…very confusing) that return an attribute table instead of a selection.  The network analyst tools are designed for working with road networks, but also work for stream networks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From here it seems like you have 2 options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.       Use python or model builder to iteratively select each dam and run a the trace tool with one dam selected at a time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.       Build a network dataset and use those tools.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what I remember, setting up the other type of network dataset was significantly more complicated, but the tools are little more robust.   Personally, I think I would lean towards option 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 22:37:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306416#M1438</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-16T22:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306417#M1439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot, Bill! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If using network analyst toolset, how can we set the flow direction? Is there a tracing tool under network analyst toolset? I can't find it.&lt;/P&gt;&lt;P&gt;Which option did you do to get the result? Option 1? Do you have more details? Can you share with me the python script? Since there are many dam points, we have to use loop, right? I just started learning python recently and it's so difficult for me to write script with no bugs....Thank you so much for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maggie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 22:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306417#M1439</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-16T22:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306418#M1440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bill, did you see my last comment? I tried to build network dataset, however, I encounter an error: "Network was build, but with some errors. The network can still be used in analysis, however the invalid features will not participate in the network", when I opened the "show build errors", I found that all my dam and gage points are listed there, so those points weren't able to participate in the network. Did you encounter this problem before?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/208206_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 20:15:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306418#M1440</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-17T20:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306419#M1441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maggie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the lapse in response.&amp;nbsp; I've been out for a few days. If you are still struggling, could you zip up a portion of you're network dataset and share it?&amp;nbsp; It has been a while since I've worked with one and I don't seem to have any good examples for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 22:38:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306419#M1441</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-22T22:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306420#M1442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bill,&lt;/P&gt;&lt;P&gt;Excited to see you're back! How can I share the zip file? I saw insert image, insert video, insert link, but no insert files. Can I send directly to your email? Many thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 22:52:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306420#M1442</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-22T22:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306421#M1443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the "Advanced Editor" option, then you will see an "Attach" link in the lower right hand corner.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 14:01:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306421#M1443</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-23T14:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306422#M1444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Bill! Here is the data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the two options that you mention:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option1: I am able to trace downstream of one dam point using the Geometric Network Analysis Toolset and then join the selective line features with gage points to get the closest gage point info. My difficulty is to write the python code of the tracing process and automate to other points;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 2: I accept the logic of treating the flowline as one way street and use the Network Analysis Toolset (specifically: find closest facilities tool) to find the closest points for all dam point at one time, however I failed to get the result because I can't find a way to set the direction so that it will find the closest facilities downstream along the flowline. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 14:59:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306422#M1444</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-23T14:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306423#M1445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let’s focus on option 1 first.  Can you send me a python snippet from the geoprocessing result?  If you run the tool, then find the geoprocessing task in the Results window, you can get a python snippet by right clicking on the result object.  I think I can get you started on a python script without actually setting up the network on my end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:39:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306423#M1445</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-23T18:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306424#M1446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Bill, with the help of an incredibly nice friend's help, we have a draft python code to work with. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached includes a test geodatabase &amp;amp; a test script (traceGeometric.py). Unfortunately, the script works, so far, on the first feature (dam) only. It does assign a closest gage ID. By the way, there are two fields with reachcode&amp;nbsp; info. of gage points because I snapped it to flowline feature class and I think using REACHCODE is the right field as gages ID instead of REACHCODE2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what she wrote about the current issue of the code:&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;After the first dam, "TraceGeometricNetwork" tool fails. The problem is, I think, the output Network/layer group. In m script, the output has to be the same as the input network, Hydro_Net. I've seen other examples and they seem to be able to create a new output. I think it would let the script to run against the rest of the dams if I can use a different output (but not so sure). The tool seems to be very picky, unfortunately. Anyway, I will share what I have so far and let you play with the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: my script runs directly from Python shell (2 not version 3, because ArcGIS doesn't use 3..), without opening ArcGIS (but you have to have ArcGIS on your local machine) and it's on Windows - below is the screenshot of the output.&lt;/P&gt;&lt;P&gt;-----------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please take a look at our data and python code how can we address the issue? Many thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 20:53:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306424#M1446</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-23T20:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306425#M1447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you add the python script?  It didn’t get included with the toolbox.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 22:01:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306425#M1447</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2016-06-23T22:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306426#M1448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is probably what you need. You can run it independent of ArcMap.&amp;nbsp; It should scale up pretty easily. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

pathToGdb =&amp;nbsp; r'C:\temp\HydroNet\TraceGeometric\test.gdb'
geoNetwork = os.path.join(pathToGdb,'Hydro','Hydro_Net')
damsFC = os.path.join(pathToGdb,'Hydro','DamPoints')
gagesFC = os.path.join(pathToGdb,'Hydro','GagePoints')

temporaryOutputGroupLayerLoc = r'in_memory\outGroup'

#loop through each dam
with arcpy.da.SearchCursor(damsFC,['SHAPE@','OBJECTID']) as cursor_Dam:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row_Dam in cursor_Dam:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Current Dam ObjectID:',row_Dam[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startGeom = row_Dam[0]

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #run the trace on a single dam
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.TraceGeometricNetwork_management(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geoNetwork,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temporaryOutputGroupLayerLoc,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # using an in_memory workspace lets you access it via python
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startGeom,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TRACE_DOWNSTREAM",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gagesFC,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "#","#","#","#",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "TRACE_ENDS")

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #loop through the output group layer to find the gages layer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for layer in arcpy.mapping.Layer(temporaryOutputGroupLayerLoc): #referencing Group Layer in_memory
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if layer.name == 'GagePoints':
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #loop through the selected gages
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(layer, 'OBJECTID') as cursor_selectedGages:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row_gage in cursor_selectedGages:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print '&amp;nbsp; Downstream Gage ObjectID',row_gage[0]

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #delete the layer temporary group layer before starting the next dam
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(temporaryOutputGroupLayerLoc)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:39:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306426#M1448</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2021-12-11T14:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: identify the nearest gages downstream from dams</title>
      <link>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306427#M1449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Bill! We will try in our computer and get back to you if there is any further question! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 23:03:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/water-resources-questions/identify-the-nearest-gages-downstream-from-dams/m-p/306427#M1449</guid>
      <dc:creator>XianyingFan</dc:creator>
      <dc:date>2016-06-23T23:03:38Z</dc:date>
    </item>
  </channel>
</rss>

