Automate Naming of Stormwater Network (Geometric network)

It could just be my perspective as an ArcGIS jockey, but handling the feature relationships in your own code sounds harder. If you take advantage of ArcGIS's ability to do that, I think it's simpler. How do you feel about spending some of your 8 weeks learning ArcGIS and Python? :) I don't know if there is a better way to traverse a network, but you can at least crawl your way up by repeatedly using "select by location" in ArcMap. You presumably could do the same in ArcObjects. But if I were doing this, I would write a python script that cycles through using select by location. We will assume that the user will select pit #1 interactively, store its name in the attribute table, and then kick off the script. Script logic looks like this:

  1. Use arcpy.MakeFeatureLayer_management to make a feature layer of all the pipes, and another feature layer of all the pits. I'll call those AllPipes and AllPits

  2. Use arcpy.MakeFeatureLayer_management with a SQL query to make a feature layer that contains (only) pit #1, named OnePit.

  3. arcpy.SelectLayerByLocation_management with the intersect operation will select the features in AllPipes that touch OnePit. Then use an edit cursor to go through those and apply whatever the business rules are for assigning names for them based on what you will name their upstream pits in the next step. Write the name into the pipe feature inside the cursor loop using the setValue method for the row object.

  4. Then for each pipe that you have selected, use arcpy.SelectLayerByLocation_management again to select everything in AllPits that intersects that pipe. (It may be necessary to make a feature layer out of each pipe using a SQL query that selects it based on its name.) This will get you two pits (upstream and down), but one of them already has a name. Assign the name to the one that doesn't have one.

  5. Now you have one or more pipe/pit pairs that you've named. Make OnePit again, using each of the pits you just gave names to in turn, lather, rinse, repeat.

One drawback of this is that for a giant network, doing select by location iteratively like that is going to be slow. Using an in-memory workspace would help a lot with that.


You can use Trace Geometric Network gp tool and accumulate in_edge_along_digitized_weight {An edge weight that is used as a cost for traversing through an edge along the digitized direction of that edge. The weight must already be defined for the given geometric network} - and - FIND_UPSTREAM_ACCUMULATION. use the accumulated value for the index