I have a waste-water geometric network with flow direction throw digitize direction. I want to check if each manhole have a line flowing in and a line flowing out. Is there an attribute of line vertex that i can use ? (like last vertex of line and first vertex of the line) what will be the check Procedure ? (I can handle basic python scripts) I'll be glad to get some help with python script for that enter image description here

  • Technically, your question seems off: You can have a manhole with only a line flowing out (beginning of a branch in the network). Also, at one point, your network will end with an outfall: a point where water leaves the network. You'll only find incoming lines there. – Tim Couwelier Jun 3 '14 at 15:38
  • That said, a non-coded workflow description: basically you need a way to get the manhole ID's from start and end into the line network. Then you cycle through all objects, and for each endpoint you check if there's a line that has it as its startpoint. If so - all is good, if not, memorise the node ID in a list. At the end, compare the list of 'endpoint only' nodes you found with the network to check if it's all outfalls. – Tim Couwelier Jun 3 '14 at 15:42
  • Thanks Tom, but Unfortunately my network is built in a way that some manholes are the beginning of the network (like sources) – Geog Jun 7 '14 at 8:22

For each line, you could create the from point using "feature vertices to point". Then you get the spatial join between the man hole and the from points (with INTERSECT), with a join_count field. If you have one intersect, this is OK, zero intersect means that you you don't have line starting from your mahole and 2 intersect mean that both lines end in the manhole.

arcpy.FeatureVerticesToPoints_management (lines, out_feature_class, "FROM")
arcpy.SpatialJoin_analysis (manholes, out_feature_class, manholejoined, "JOIN_ONE_TO_ONE", "KEEP_ALL", {field_mapping}, "INTERSECT")
arcpy.Select_analysis (manholejoined, manholeOK, """ "Join_count" = 1 """)

Note that in case of more than two lines, you could count the from and the to points separately. And if you want to loop on the geometry, you can use the properties .firstPoint and .lastPoint on a polyline object (e.g. from arcpy.da.updateCursor).

Edit: another method based on @Michael Miles-Stimson's comment:

  1. create "from" points
  2. create "to" points
  3. select by location manholes that intersect the from points
  4. select by location manholes that intersect the to points (SUBSET_SELECTION)
  5. switch selection to have the suspect manholes
  • How do you check flow direction against digitize direction using your method? – artwork21 Jun 3 '14 at 10:43
  • @artwork21 From my understanding, the OP has already set the flow direction according to the digitize direction (this is one of the options for SetFlowDirection_management) resources.arcgis.com/en/help/main/10.2/index.html#//… – radouxju Jun 3 '14 at 11:22
  • Nice one @radouxju. To check if a manhole has a line flowing 'in' use the "to" in FeatureVerticesToPoints. You could do select by location and invert for each from and to case and any that remain selected are suspect. That would simplify the problem down to about a dozen lines of python. – Michael Stimson Jun 4 '14 at 2:34
  • @artwork21 - I'm using flow by digitize direction and checking flow direction visually and with the "top level" attribute of the manholes. – Geog Jun 7 '14 at 8:26

A way of doing this is to cycle through your man hole dataset, use each point to select the polylines then test if your man hole point equals the last point of the polyline, if it does then the polyline must be flowing into it.

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.