Hello i have a point and i want to create polylines for every 5o from 180o to 360o (north azimuth). How can i do that with azimuth and bearings?
Solved! Go to Solution.
Here's how you can automate this with arcpy geometry objects:
>>> import math >>> length = 100000 >>> lines = [] >>> degrees = 5 >>> with arcpy.da.SearchCursor("YOUR_POINT_LAYER_NAME_HERE","SHAPE@") as cursor: ... for row in cursor: ... for i in range(360/degrees): ... dx = math.cos(math.radians(i*degrees))*length ... dy = math.sin(math.radians(i*degrees))*length ... startPoint = row[0].centroid ... endPoint = arcpy.Point(row[0].centroid.X+dx,row[0].centroid.Y+dy) ... line = arcpy.Polyline(arcpy.Array([startPoint,endPoint])) ... lines.append(line) ... >>> arcpy.CopyFeatures_management(lines,'in_memory\lines')
edit: I just read the point about limiting between 180 and 360. This can be incorporated into the above script.
if you want geodesic line features, check the help top here on distance and bearing
Here's how you can automate this with arcpy geometry objects:
>>> import math >>> length = 100000 >>> lines = [] >>> degrees = 5 >>> with arcpy.da.SearchCursor("YOUR_POINT_LAYER_NAME_HERE","SHAPE@") as cursor: ... for row in cursor: ... for i in range(360/degrees): ... dx = math.cos(math.radians(i*degrees))*length ... dy = math.sin(math.radians(i*degrees))*length ... startPoint = row[0].centroid ... endPoint = arcpy.Point(row[0].centroid.X+dx,row[0].centroid.Y+dy) ... line = arcpy.Polyline(arcpy.Array([startPoint,endPoint])) ... lines.append(line) ... >>> arcpy.CopyFeatures_management(lines,'in_memory\lines')
edit: I just read the point about limiting between 180 and 360. This can be incorporated into the above script.
THAT WAS HELP F U L L !