Thanks Darren! I am so new to Python I knew I didn't have time to attempt to figure it out on my own. I can't wait to try this....
>>> Darren Wiens <geonet@esri.com> 7/24/2015 4:29 PM >>>
GeoNet
( https://community.esri.com/?et=watches.email.thread)
Can I place a line on a point using an attribute for the angle?
reply from Darren Wiens
( https://community.esri.com/people/dkwiens?et=watches.email.thread) in Developers - View the full discussion
( https://community.esri.com/message/538527?et=watches.email.thread#538527)
Here's a script that should do what you're after:
>>> newLines = []
... points = "grid_label"
... angleField = "OID"
... lineLength = 300
... sr = arcpy.Describe(points).spatialReference
... with arcpy.da.SearchCursor(points,["SHAPE@",angleField]) as cursor:
... for row in cursor:
... x1 = row[0].centroid.X + (math.sin(math.radians(row[1]))*(lineLength/2))
... y1 = row[0].centroid.Y + (math.cos(math.radians(row[1]))*(lineLength/2))
... x2 = row[0].centroid.X - (math.sin(math.radians(row[1]))*(lineLength/2))
... y2 = row[0].centroid.Y - (math.cos(math.radians(row[1]))*(lineLength/2))
... newLine = arcpy.Polyline(arcpy.Array())
... newLines.append(newLine)
... arcpy.CopyFeatures_management(newLines,r'in_memory\lines')
https://community.esri.com/servlet/JiveServlet/downloadImage/2-538527-118816/pastedImage_0.png
( https://community.esri.com/servlet/JiveServlet/showImage/2-538527-118816/pastedImage_0.png)
Reply to this message by replying to this email, or go to the message on GeoNet
( https://community.esri.com/message/538527?et=watches.email.thread#538527)
Start a new discussion in Developers by email
( mailto:discussions-community-developers@mail.geonet.esri.com) or at GeoNet
( https://community.esri.com/choose-container.jspa?contentType=1&containerType=14&container=2030&et=watches.email.thread)
Following Can I place a line on a point using an attribute for the angle?
( https://community.esri.com/message/538527?et=watches.email.thread#538527) in these streams: Inbox
This email was sent by GeoNet because you are a registered user.
You may unsubscribe
( https://community.esri.com/unsubscribe.jspa?email=kmuma%40peterborough.ca&token=ddc1f5090c4eb13f98ad6c7c0516de919c7f5c29e1486eca3c3d526bae9eca83) instantly from GeoNet, or adjust email frequency in your email preferences
( https://community.esri.com/user-preferences!input.jspa)