# Determining and selecting certain line using spatial analysis?

I have some lines on a picture. I need a green line to be selected as a reason to having a wrong parameter which painted this line green, not red. The yellow one seems to be almost perpendicular to red, and don't need to be selected. I tried to figure out how to make an angle list of all lines which are not red. The angle is measured in clockwise direction according to an intersection of red and other lines. Then I need to select only those lines, which angle is close to zero (or < 25 for example). How can this task be solved? Unfortunately, I don't know anything from ArcPy, use only tools from system toolboxes to make a model in modelbuilder.

• Do this lines share end node? Commented Aug 6, 2016 at 2:46
• yes, all the lines are split at their intersections and have nodes there Commented Aug 6, 2016 at 7:30
• Tricky without Python. Anyway. Derive end points for non red lines. Spatial join to red lines, closest with distance. Sort descending and delete identical by line I'd. From here it is Pythagoras, acos(distance/length) Commented Aug 6, 2016 at 7:49
• @FelixIP okay, I'll try a bit later at home. Thank you for advice! Commented Aug 6, 2016 at 8:12
• @FelixIP I did almost all that you recommend but can't get about acos, it gives an error. Here are the model and results. [1]: i.sstatic.net/ZRaJK.png [2]: i.sstatic.net/AEji5.png If you could give me a tip what to do next to calculate angle between red lines and those dotes, it would be very helpful! Commented Aug 6, 2016 at 17:22

Input:

Note: two highlited fields are NOT originally in the table, they will be added later.

Workflow:

arcpy.MakeFeatureLayer_management("all_lines","RED_LINES",""""COLOR" = 'RED')
arcpy.MakeFeatureLayer_management("all_lines","OTHER_LINES",""""COLOR" <> 'RED')
arcpy.FeatureVerticesToPoints_management("OTHER_LINES","C:/FELIX_DATA/SCRARCH/end_points.shp","BOTH_ENDS")
arcpy.SpatialJoin_analysis("end_points","RED_LINES","C:/FELIX_DATA/SCRARCH/sj.shp","JOIN_ONE_TO_ONE","KEEP_ALL","""ITEMID "ITEMID" true true false 20 Text 0 0 ,First,#,C:/FELIX_DATA/SCRARCH/end_points.shp,ITEMID,-1,-1""","CLOSEST","#","Distance")
arcpy.Sort_management("sj","C:/FELIX_DATA/SCRARCH/sorted.shp","Distance DESCENDING")
arcpy.DeleteIdentical_management("sorted","ITEMID","#","0")
arcpy.CalculateField_management("OTHER_LINES","all_lines.D_2_RED","[sorted.Distance]","VB","#")
OTHER_LINES"
arcpy.RemoveJoin_management("OTHER_LINES","sorted")