I want to create offset/parallel lines for my centre lines (over 12000 polylines) in different distance for each class number(i have numbers in column) and with the same line direction as centre line.
My idea was to create mid point for each line and then move the line at the same angle but i don't know how to do it in Python.
Also i know the way creating line buffer, splitting buffer etc. but then lines are not in the same direction and ArcGIS Pro basic not support polygon to lines tools etc.
The problem is that I am using basic licence in ArcGIS Pro which not support advanced tools.
Is there any way to do it using Python script?
import arcpy #setup inputs inFC = arcpy.GetParameterAsText(0) outFC = arcpy.GetParameterAsText(2) #setup output path fcPath = outFC.rpartition("\\") fcName = outFC.rpartition("\\") if arcpy.Exists(outFC): arcpy.Delete_management(outFC) arcpy.CreateFeatureclass_management(fcPath,fcName,"POLYLINE","#","DISABLED","DISABLED",inFC) arcpy.AddField_management(outFC,"inFID","LONG","#","#","#","#","NULLABLE","NON_REQUIRED","#") def shift_features(inFC): """ Shifts features by an x and/or y value. The shift values are in the units of the inFC coordinate system. Parameters: inFC: string An existing feature class or feature layer. If using a feature layer with a selection, only the selected features will be modified. x_shift: float The distance the x coordinates will be shifted. y_shift: float The distance the y coordinates will be shifted. """ with arcpy.da.UpdateCursor(inFC, ['SHAPE@XY', 'Shift_X_right', 'Shift_Y_right']) as cursor: for row in cursor: cursor.updateRow([[row + (row or 0), row + (row or 0)]]) return outFC = shift_features(inFC)
I try to shift my lines using attribute stored inside my table. When i put normal x_shift value like 2 meters shift function work correctly. But when i try to call my table it creates error. I don't know if shift function support shifting by attribute table values. Can you help me?
UPDATE If that will help i got script that do the same us feature vertix to points.
# Feature Class to Points # # Paul Smith (2012) email@example.com # Imports import arcpy import numpy #Inputs from user parameters InFc = arcpy.GetParameterAsText(0) OutFc = arcpy.GetParameterAsText(1) # Spatial reference of input feature class SR = arcpy.Describe(InFc).spatialReference # Create NumPy array from input feature class array = arcpy.da.FeatureClassToNumPyArray(InFc,["SHAPE@XY"], spatial_reference=SR, explode_to_points=True) # Check array and Exit if no features found if array.size == 0: arcpy.AddError(InFc + " has no features.") # Create a new points feature class else: arcpy.da.NumPyArrayToFeatureClass(array, OutFc, ['SHAPE@XY'], SR)