I started a similar project to create a tool that split a parcel in half if there were two address points in the parcel, when the parcel was a corner property. It needed ET_GeotoolsI created a line for the split by bisecting the two points and used that to intersect the polygon. You can then write the split polygon back to the featureclass.# bisect2
# bisect a parcel into two
# between two points inside
# extend to multipoints later
# input parcel_id
# select parcel poly
# select address points
# if two points
# calculate perpendicular bisector
# cut polygon with the line
# save to be replaced
# 26 Nov 2010
#
import arcgisscripting,sys,os,math
gp = arcgisscripting.create(9.3)
def createknife(par_id):
"""create knife lines for bulk splitting
using address points with same parcel_id"""
gp.MakeFeatureLayer_management(fcAdd,"add_lay","parcel_id = "+str(par_id))
shapeField = gp.Describe(fcAdd).shapeFieldName
cur = gp.SearchCursor("add_lay","parcel_id = "+str(par_id),SR)
row = cur.next()
n = 0
pt = []
while row:
pt.append(row.getValue(shapeField).centroid)
n+=1
row = cur.next()
del row,cur
## print n, "points"
##for addpt in pt:
## print "address ",addpt.X,addpt.Y
# find mid point and angle, add 90 degrees
midpt = gp.CreateObject("Point")
midpt.X = (pt[0].X + pt[1].X)/2.0
midpt.Y = (pt[0].Y + pt[1].Y)/2.0
radAngle = math.atan2(pt[0].Y - pt[1].Y,pt[0].X - pt[1].X) + math.pi/2.0
# print "midpoint",midpt.X,midpt.Y,"Bearing",radAngle
# create a perpendicular line in a temp fc
ext = gp.Describe("in_memory/parcel").extent
size = max(ext.width,ext.height)*1.5
print par_id,size
pnt1 = gp.CreateObject("Point")
pnt2 = gp.CreateObject("Point")
pnt1.X = midpt.X - size * math.cos(radAngle)
pnt1.Y = midpt.Y - size * math.sin(radAngle)
pnt2.X = midpt.X + size * math.cos(radAngle)
pnt2.Y = midpt.Y + size * math.sin(radAngle)
pline = gp.CreateObject("Array")
pline.Add(pnt1)
pline.Add(pnt2)
##print "knife %8.1f %8.1f %8.1f %8.1f" % (pnt1.x,pnt1.y,pnt2.x,pnt2.y)
cur = gp.InsertCursor("in_memory/knife")
row = cur.newRow()
row.shape = pline
cur.insertRow(row)
row = cur.newRow()
pline.removeAll()
del cur,row
# temp debugging
outLine = gp.CreateScratchName("split_line","","FeatureClass")
gp.CopyFeatures_management("in_memory/knife",outLine)
##print "Knife extent",gp.Describe("in_memory/temp").extent
##print "Parcel extent",gp.Describe("in_memory/parcel").extent
##print "Address extent",gp.Describe("add_lay").extent
##outAdd = gp.CreateScratchName("split_add","","FeatureClass")
##gp.CopyFeatures_management("add_lay",outAdd)
gp.AddToolbox(r"C:\Program Files\ET SpatialTechniques\ET GeoWizards 10.0 for ArcGIS 9.2 and 9.3\ET GeoWizards.tbx")
outParcel = "in_memory/split" #gp.CreateScratchName("split_parcel","","FeatureClass")
gp.ET_GPPartitionPolygons("in_memory/parcel","in_memory/temp",outParcel)
# print gp.GetMessages()
return outParcel
# -------------------- main -----------------------
try:
fcPar = sys.argv[1]
except:
fcPar = "corner"
gp.overwriteOutput = True
ws = "d:/work/pcl/CourierRun.gdb"
gp.workspace = ws
fcAdd = "addrun"
SR = gp.CreateObject("SpatialReference")
SR.CreateFromFile("c:/arcgis/nztm.prj")
gp.CreateFeatureClass("in_memory","knife","Polyline","","","",SR)
rCursor = gp.SearchCursor(fcPar)
row = rCursor.next()
while row:
par_id = row.par_id
result = split(par_id)
row = rCursor.next()