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!
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,
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.positionAlongLine(0.5,True) # get midpoint
... pt_before = sRow.positionAlongLine(sRow.measureOnLine(midpoint)-0.1) # get a point just a little before the midpoint
... ang = pt_before.angleAndDistanceTo(midpoint) # calculate angle
... iCur.insertRow((midpoint,ang)) # insert feature