I have a feature table with a field (Float) containing percentage values which aggregates to 100%. And I have one big polygon. I need to split the polygon based on the percentage values from the table.
I have seen a similar tool in ET's GeoTools.
But I don't have the tool.
Is there any workaround in ArcGIS? Maybe using Python?
Thanks for your quick response. The above tools you mentioned, splits the polygon feature parts from the feature class and exports them to different feature classes.
My case is a little different. My polygon feature class has only one polygon (01 record). And the splitting should be based on the percentage values from another GDB table.
An example of resulting polygon is attached (ET GeoTools used in this case).
Let me know if you have any further suggestion.
Looks like you have one polygon and another one is feature or one table with % values.
If both are features, then overlay works and for another I need to test in my system.
Let you know my findings.
can you please give me yours sample files.
Second one is a table.
You can create a sample as below.
Create any random polygon (with UTM/WGS_1984 projection).
And a table with 4 records where a field <Field_Per> will have values of say 20, 35, 15, 30 for the four records.
Thanks again for your efforts.
Thank you for sharing the link. But my problem is different. The polygon needs to be split into variable sizes (area) based on the percentage value from another table.
You can try this script. I'm not familiar with the ET-Geotools version, but I think it does more or less the same. It adds the split parts to the existing polygon layer, but you can change it to write to a new feature class.
import arcpy mxd = arcpy.mapping.MapDocument('CURRENT') df = mxd.activeDataFrame layers = arcpy.mapping.ListLayers(df) # select layer - my known polygon layer with only one polygon poly = layers # split steps splits = [20, 30, 50] # get polygon and extent properties with arcpy.da.SearchCursor(poly, ["SHAPE@"]) as pcursor: for prow in pcursor: polygon = prow # polygon to cut e = polygon.extent # bounding extent of polygon print e.XMin,e.YMin,e.XMax,e.YMax del pcursor # geometric cut test iteration step size - modify value to get better accuracy stepsize = 0.001 # set parameters to move from left to right over the polygon leftXstart = e.XMin leftX = e.XMin + stepsize ymax = e.YMax ymin = e.YMin cutpoly = polygon icursor = arcpy.da.InsertCursor(poly, ["SHAPE@"]) # iterate cut percentage list for i in splits[:2]: print i tol = 0 while tol < i: # construct NS line pntarray = arcpy.Array() pntarray.add(arcpy.Point(leftX, ymax)) pntarray.add(arcpy.Point(leftX, ymin)) pline = arcpy.Polyline(pntarray,arcpy.SpatialReference(4326)) # cut polygon and get split-parts cutlist = cutpoly.cut(pline) tol = 100 * cutlist.area / polygon.area leftX += stepsize #print str(leftX) + ":" + str(tol) cutpoly = cutlist # part 0 is on the right side and part 1 is on the left side of the cut icursor.insertRow([cutlist]) # insert last cut remainder icursor.insertRow([cutlist]) del icursor
This is the result for cutting the polygon into 20%, 30% and 50%
Hi FC Basson,
I wanted to know if you could help me with your script that you have. It does not want to run for me. It gets to line 13 and says, " with arcpy.da.SearchCursor(poly, ["SHAPE@"]) as pcursor: TypeError: 'in_table' is not a table or a featureclass" do you know what might be causing this?
I fixed the last issue but now have another. This is the error that comes up:
Traceback (most recent call last):
File "C:\Users\jacob.siech\Desktop\TestScript.py", line 42, in <module>
cutlist = cutpoly.cut(pline)
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\arcobjects\arcobjects.py", line 859, in cut
RuntimeError: All geometries involved in this operation must have the same spatial reference.
I have checked the spatial reference of the data fraim and the layer and they are the same. So I do not know what to do now. Any help would be great.