I am looking for data that would function in a field calculator and would automatically rotate a point symbol (or water pipe cap symbol) 90 degrees to a line featureclass. I have aprox. three thousand point symbols and rotating all of them manually is cost prohibitive. Attached is an example of what I am trying to achieve and if there are other methods please share.
Thanks,
Larry Adgate
Solved! Go to Solution.
Your main task is figuring out the angle of the line and transferring it to the point. You can do this using arcpy Polyline geometry vertices, good, old-fashioned trigonometry, and a Spatial Join.
When you've got some code going, post it for more help.
Larry ... you might want to 'unanswer' your question as being answered, should you wish to get a response
Your main task is figuring out the angle of the line and transferring it to the point. You can do this using arcpy Polyline geometry vertices, good, old-fashioned trigonometry, and a Spatial Join.
When you've got some code going, post it for more help.
Thank You Darren, This is enough information to solve the issue
Here is some code that should get you most of the way there:
>>> import math ... arcpy.CreateFeatureclass_management(r'in_memory','points',"POINT") ... arcpy.AddField_management(r'in_memory\points',"Angle","DOUBLE") ... sr = arcpy.Describe("line").spatialReference ... insCur = arcpy.da.InsertCursor(r'in_memory\points',["SHAPE@","Angle"]) ... with arcpy.da.SearchCursor("line","SHAPE@",spatial_reference=sr) as cursor: ... for row in cursor: ... for part in row[0]: ... first = 1 ... for pnt in part: ... if first == 0: ... dx = pnt.X - prev.X ... dy = pnt.Y - prev.Y ... angle = math.degrees(math.atan(dy/dx))+90 ... insCur.insertRow([pnt,angle]) ... prev = pnt ... first = 0
...and the resulting points, symbolized using Arithmetic rotation style.
Hi Darren, thanks for the script, this is really more than what I expected,
Larry