I have a python script that takes a shapefile of points and moves those points to a new location. The output feature only has FID, ID, and geometry type, is there a way to preserve the attributes from the original shapefile with the new geometries.
Here is the part of the script that moves the feature, which works great:
infc = Saved_Layer
rows = arcpy.da.SearchCursor(infc, ["Easting", "Northing", "Test_Type"])
point = arcpy.Point()
pointGeometryList=[]
for row in rows:
x = row[0]
y = row[1]
TestType = row[2]
if TestType == 'MTU':
distance = .3535535
angle = 45
(disp_x, disp_y) = (distance * sin(radians(angle)),\
distance * cos(radians(angle)))
(end_x,end_y) = (x + disp_x, y + disp_y)
point = arcpy.Point(end_x, end_y)
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry)
elif TestType == 'TU':
distance = .707107
angle = 45
(disp_x, disp_y) = (distance * sin(radians(angle)),\
distance * cos(radians(angle)))
(end_x,end_y) = (x + disp_x, y + disp_y)
point = arcpy.Point(end_x, end_y)
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry)
# Create feature from geometry list
arcpy.CopyFeatures_management(pointGeometryList, "Points.shp")
fc = "Points.shp"
spatialref = arcpy.SpatialReference(prjfile)
arcpy.DefineProjection_management(fc, spatialref)
I have tried searchcursor, updateCursor, insertcursor, and spatial joins but when I use the cursor all I get is the first X and Y repeated in every row. The new geometries only need to include three fields from the original shapefile.
Here is the part of the script that moves the feature, which works great:
infc = Saved_Layer
rows = arcpy.da.SearchCursor(infc, ["Easting", "Northing", "Test_Type"])
point = arcpy.Point()
pointGeometryList=[]
for row in rows:
x = row[0]
y = row[1]
TestType = row[2]
if TestType == 'MTU':
distance = .3535535
angle = 45
(disp_x, disp_y) = (distance * sin(radians(angle)),\
distance * cos(radians(angle)))
(end_x,end_y) = (x + disp_x, y + disp_y)
point = arcpy.Point(end_x, end_y)
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry)
elif TestType == 'TU':
distance = .707107
angle = 45
(disp_x, disp_y) = (distance * sin(radians(angle)),\
distance * cos(radians(angle)))
(end_x,end_y) = (x + disp_x, y + disp_y)
point = arcpy.Point(end_x, end_y)
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry)
# Create feature from geometry list
arcpy.CopyFeatures_management(pointGeometryList, "Points.shp")
fc = "Points.shp"
spatialref = arcpy.SpatialReference(prjfile)
arcpy.DefineProjection_management(fc, spatialref)
I have tried searchcursor, updateCursor, insertcursor, and spatial joins but when I use the cursor all I get is the first X and Y repeated in every row. The new geometries only need to include three fields from the original shapefile.