Draw lines perpendicular to intersections.

Discussion created by wtgeographer on Jun 10, 2014
I am looking for some help with some logic regarding ensuring line A crosses line B perpendicularly.  SO far my approach has been to 1)generate points at the intersections
2)Get bearing from segment of line B where intersection occurs.
3) calculate a perpendicular bearing

I wish to take this bearing and extend it to line A then trim and clean.

The attached image and script should help explain.  I also am interested in easier logic if someone has done this before?

Image:
[ATTACH=CONFIG]34487[/ATTACH]
```    fclist = arcpy.ListFeatureClasses("Simplified_LCP_*","Line")

for fc in fclist:

arcpy.MakeFeatureLayer_management(sps_lines, "feature_layer")
lyrfile = arcpy.SelectLayerByLocation_management("feature_layer","INTERSECT",fc,"#","NEW_SELECTION")
count =  int(arcpy.GetCount_management(lyrfile).getOutput(0))
if count > 0:
# Print Intersecting line and number of intersections
print "While examining {0}, {1} intersections were found." .format(fc,count)
arcpy.Intersect_analysis([fc,sps_lines],Modified(fc),"ALL","#","POINT")

for row in arcpy.da.SearchCursor("sps_lines_fl","BEARING"):
bearing = row[0]
if bearing >= 0 and bearing <= 270:
# Print intersecting line and bearing of sps line at intersection
perp = bearing + 90
print "{0}, Perpendicular value is: {1}" .format (fc, perp)
else:
perp = (bearing + 90) - 360
print "{0}, Perpendicular value is: {1}" .format (fc, perp)
```