I am trying to project a line perpendicular from the midpoint along a polyline that I have split at regular intervals. I am getting the below error but everything up to that point seems to be working. Can someone advise on what I am doing wrong? I guess there is an obvious simple step with transforming the original shapefile that I am missing. Thanks!
from math import atan2, pi
import arcpy as arc
input_shp = 'C:/Users/agood/OneDrive - USN/Python/Paper 1 Analysis/Python/Meltwater Tran_SplitLineAtPo.shp'
e = 1e-10 #epsilon
Cursor = arcpy.SearchCursor(input_shp)
for feature in Cursor:
Midpoint = feature.shape.positionAlongLine(0.5,True).firstPoint #find midpoint along each line segment
#getpoints immediately before and after midpoint
before = feature.shape.positionAlongLine(0.5-e,True).firstPoint
after = feature.shape.positionAlongLine(0.5+e,True).firstPoint
dX = after.X - before.X
dY = after.Y - before.Y
#return angle of midpoint section. We will plot a line at 90 degrees from this angle.
angle = atan2(dX, dY)* 180/pi
newpoint=Midpoint.point.pointFromAngleAndDistance(angle + 90, 400)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
In [33]:
Line 16: newpoint=Midpoint.point.pointFromAngleAndDistance(angle + 90, 400)
AttributeError: 'Point' object has no attribute 'point'
---------------------------------------------------------------------------
try
Midpoint.pointFromAngleAndDistance