Rotation angle of line midpoints to represent direction/flow arrows

01-06-2017 12:15 PM
New Contributor II

I am finding out that ArcGIS Online (or web browsers in general) don't support complex line symbology. I want to simply add arrows on the midpoint of a line with an arrow pointing in the direction that the feature was drawn to show water flow direction. All features were drawn in the direction of flow. Since I can't push the line symbology with arrows out to my ArcGIS online map i thought i would create midpoints for each of the features and simply represent the direction of flow with a arrow (point feature) that is rotated the same angle as the line in the direction that it was drawn. Is there a way I can get the line angle (direction in which it was drawn) into an attribute field so i can then spatially join that angle to my midpoints? 

I am also open to other ways of doing this if someone has a suggestion. Thank you in advance!


4 Replies
New Contributor

I'm trying to accomplish the same thing,  Were you able to figure it out? 

0 Kudos
New Contributor II

Hi Kevin,

I contacted ESRI and they didn’t have a good solution for this but I was able to come up with my own solution. Download and install ET Geowizards and use their tool called “polylines to points”. Using this tool you can select the option to create “middle points” on your lines and select “assign angle attributes to points” this will give you mid points with the rotation angle of your original lines as an attribute. Change the point symbology to an arrow or triangle and use the symbology ( click Layer Properties - Symbolgy- Advanced- Rotation) to display your arrows facing the correct direction using the angle attributes. You will need to display your line and points as 2 separate feature layers but it works!

Hope this helps,


0 Kudos
MVP Honored Contributor

You can do it with the following Python script:

>>> fc = 'lines' # lines feature class
... fc_sr = arcpy.Describe(fc).spatialReference # spatial ref
... points = 'midpoints' # existing point feature class
... ang_field = 'ANGLE' # must have field to hold angle value, type double
... iCur = arcpy.da.InsertCursor(points,['SHAPE@',ang_field]) # insert cursor
... with arcpy.da.SearchCursor(fc,'SHAPE@',spatial_reference=fc_sr) as sCur: # loopo through lines
...     for sRow in sCur:
...         midpoint = sRow[0].positionAlongLine(0.5,True) # get midpoint
...         pt_before = sRow[0].positionAlongLine(sRow[0].measureOnLine(midpoint)-0.1) # get a point just a little before the midpoint
...         ang = pt_before.angleAndDistanceTo(midpoint) # calculate angle
...         iCur.insertRow((midpoint,ang[0])) # insert feature

New Contributor II

That's an amazing solution! Thank!

0 Kudos