4

We have a geometric network with sewer pipes that have their flow direction based on digitized direction. Some of the pipes, however, have indeterminate flow. We would like to find all the pipes that have indeterminate flow. We can do this by setting the flow direction arrows and identifying these pipes visually/manually, however, since this is a rather large network, is there a way/tool that can identify all the pipes that have indeterminate flow in a simpler, en masse method? We are using ArcGIS 10.2.2.

  • When you set flow direction based on digitized direction, you won't have an indeterminate flow! That's weird! – Farid Cheraghi Sep 30 '15 at 20:23
  • Fadir, you are correct, however, from time to time we see segments that show indeterminate flow at which point we have to reestablish the flow for them. We are not sure whats causing this and it only happens to a very very small number of the pipes. – Steve Sep 30 '15 at 20:34
4

To my knowledge there is no tool that can do what you are asking, this needs to be done in a programmatic way. If you have VBA installed and licensed then the following code will select indeterminate edges. It assumes the geometric network is the first layer in your TOC and you need to edit the line to update it with the name of your featuredataset (current its set to mine which was eu_riv).

Public Sub SelectIndeterminateEdges()
    ' Description: Selects all edges in a geometric network that are indeterminate
    ' Author: Duncan Hornby
    ' Created 30/9/15

    ' Get MapDocument
    Dim pMXD As IMxDocument
    Set pMXD = ThisDocument

    ' Get Map
    Dim pMap As IMap
    Set pMap = pMXD.FocusMap

    ' Get Layer (assumed to be first layer in TOC) and its selectionset
    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pMap.Layer(0)
    Dim pFeatureSelection As IFeatureSelection
    Set pFeatureSelection = pFeatureLayer
    Dim pSelSet As ISelectionSet
    Set pSelSet = pFeatureSelection.SelectionSet

    ' Cast into Dataset
    Dim pDataset As IDataset
    Set pDataset = pFeatureLayer

    ' Get workspace
    Dim pWorkspace As IWorkspace
    Set pWorkspace = pDataset.Workspace

    ' Cast into FeatureWorkspace
    Dim pfeatureworkspace As IFeatureWorkspace
    Set pfeatureworkspace = pWorkspace

    ' Get FeatureDataset, note this code assumes you know the name of this, in this example it is eu_riv
    Dim pFDS As IFeatureDataset
    Set pFDS = pfeatureworkspace.OpenFeatureDataset("eu_riv")

    ' Get Network
    Dim pNetColl As INetworkCollection2
    Set pNetColl = pFDS
    Dim pGN As IGeometricNetwork
    Set pGN = pNetColl.GeometricNetwork(0)
    Dim pNet As INetwork
    Set pNet = pGN.Network

    ' Get enumerate over all edges
    Dim pEnum As IEnumNetEID
    Set pEnum = pNet.CreateNetBrowser(esriETEdge)

    ' Cast into untilitynetwork
    Dim pUtilNet As IUtilityNetwork
    Set pUtilNet = pNet
    Dim pNetEle As INetElements
    Set pNetEle = pNet

    ' Main loop
    Dim eid As Long
    Dim i As Long
    Dim classid As Long
    Dim oid As Long
    Dim subid As Long

    For i = 1 To pNet.EdgeCount
        eid = pEnum.Next
        If pUtilNet.GetFlowDirection(eid) = esriFDUninitialized Or pUtilNet.GetFlowDirection(eid) = esriFDIndeterminate Then
            ' Found an edge that is either uninitialized or indeterminate
            ' adding to selection set
            pNetEle.QueryIDs eid, esriETEdge, classid, oid, subid
            pSelSet.Add oid
        End If
    Next i

    ' Refresh screen
    pMXD.ActiveView.Refresh
End Sub
  • Hornbydd, this worked like a charm! Thank for replying and posting this solution. – Steve Sep 30 '15 at 20:24
  • Glad to have helped, it was an interesting problem that required me to delve into the darkest parts of my memory of long lost coding! Also shows that VBA is awesome for knocking out little nuggets of code that require access to ArcObjects (stuff that arcpy does not expose). – Hornbydd Sep 30 '15 at 22:03

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.