While trying to rotate the end caps of a water network in ArcMap, i calculated the rotation of the connected water main using the field calculator, then did a spatial join to transfer the attribute to the cap and used rotation in symbology to implement the rotation. My problem is as shown in the picture below. The end caps that are left of the watermain are correct but the ones on the right are not. It is quite logical if you consider the angle.
The python code used for the angle calculation is:
Expression: GetAzimuthPolyline( !Shape!) Code Block: import math def GetAzimuthPolyline(shape): radian = math.atan((shape.lastpoint.x - shape.firstpoint.x)/(shape.lastpoint.y - shape.firstpoint.y)) degrees = radian * 180 / math.pi return degrees
Is there a better way to do this kind of symbology without being affected by the line direction?
Probably something like "perpendicular to line".