I am attempting to create a script tool to automate some processes at work. Part of this process was to manually cut (using Cut under Editor) a buffer. My approach to this has been to try and split the polygon instead by using the line layer that we were tracing. However you cannot split using a polyline AFAIK, and I would prefer to avoid using 'Feature to Polygon' as Advanced licences are limited at my workplace. For the same reason I am not sure if I can use the 'buffer to one side technique'.

I have been reading up on how to convert polylines to polygons and I have completed part of the process:

# Feature Class to Points
# Paul Smith (2012) paul@neoncs.com.au

# Imports
import arcpy
import numpy
from arcpy import env

env.workspace = "U:/ArcGIS"

#Inputs from user parameters
InFc  = "U:/ArcGIS/Default.gdb/clipdefenses"
OutFc = "U:/ArcGIS/Default.gdb/clipdefpoly"

# 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
arcpy.da.NumPyArrayToFeatureClass(array, OutFc, ['SHAPE@XY'], SR)

So I have the points of my polyline, but I am unsure of the next steps to create a polygon out of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.