Select to view content in your preferred language

Rotate Point Symbol

3261
5
Jump to solution
10-22-2015 09:24 AM
LarryAdgate
Occasional Contributor

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     

0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
MVP Honored Contributor

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.

View solution in original post

5 Replies
DanPatterson_Retired
MVP Emeritus

Larry ... you might want to 'unanswer' your question as being answered, should you wish to get a response

DarrenWiens2
MVP Honored Contributor

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.

LarryAdgate
Occasional Contributor

Thank You Darren, This is enough information to solve the issue

0 Kudos
DarrenWiens2
MVP Honored Contributor

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.

0 Kudos
LarryAdgate
Occasional Contributor

Hi Darren, thanks for the script, this is really more than what I expected,

Larry

0 Kudos