Split polygon feature by percentage

15092
19
08-11-2016 06:49 AM
JayantaPoddar
MVP Esteemed Contributor

Hi friends,

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.

http://www.ian.ko.com/ET_GeoTools/UserGuide/ETSplitPolygonByArea.htm

But I don't have the tool.

Is there any workaround in ArcGIS? Maybe using Python?



Think Location
0 Kudos
19 Replies
WesMiller
Regular Contributor III

Could you post the code you are currently using? If you are using the code from above line 40 sets a spatial reference that may be different from the feature class you are using.

0 Kudos
JacobSiech1
New Contributor III

Hi Wes,

Yup you are right I found that my projection was different than that was in the code so I changed it and now it work  yea.  Now I just need to adapt the code to do multiple polygons and to cut the polygon based on attributes  You wouldn't have any input on how to go about doing this?  Any help would be great.

Thanks,

~J~S~

0 Kudos
JacobSiech1
New Contributor III

I got the code to work however I wanted to know if there was anyway to have the code cut the polygon parallel to one of the sides.  Since in my case I am cutting rectangles I would like it to cut those rectangles parallel to one of the side.  Is this possible?

Thanks,

~J~S~

0 Kudos
FC_Basson
MVP Regular Contributor

Automating the process to detect the angle of the correct side might be tricky unless you provide it as an attribute for the polygon feature, but you can definitely cut at an angle by setting different X-values for the cut-line's start and end points (lines 38 and 39) - you just need to determine the difference based on the required angle.

0 Kudos
JacobSiech1
New Contributor III

Hi FC Basson,

Thanks for the reply.  I changed the value or at lease added a value to the X-value and it work like you said.  However I am still a little hazy on how to find the value using an angle.  I just use trial and error for one of the polygons but this will obviously not work for more than 200 polygon that I have to do.  I guess I could find the value for each the first time and put it in an attribute and add that value to the X-value but that could take some time.  Is there a way to calculate this value using the attribute calculate functions?

Thanks,

~J~S~

0 Kudos
JacobSiech1
New Contributor III

Hi,

I have a similar issue however I have multiple polygons in my case some 200 polygons and I would like to split them based on a percentage.  I don't really know how to structure my data either to achieve my end result.  Basically I have 200 building footprints each building has multiple tenants and I want to split the polygons by the percentage of space each tenant is occupying.  Currently I have all the polygons or building footprints in one layer and all the tenants in a point layer.  I have looked all over and have found no solution to this problem any help would be great.

Thanks,

Jake

0 Kudos
DanielThen
New Contributor

Hi FC Basson,

Thank you for sharing the code. I have tried to adapt it to work for my layer but it came up with an error:

Runtime error

Traceback (most recent call last):

File "<string>", line 36, in <module>

File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\arcobjects.py", line 825, in cut

return convertArcObjectToPythonObject(self._arc_object.Cut(*gp_fixargs((other,))))

RuntimeError: A polygon cut operation could not classify all parts of the polygon as left or right of the cutting line.

line 36: cutlist = cutpoly.cut(pline)

Do you have any idea the error came up?

Regards,

Daniel

0 Kudos
Vaibhavsingh10
New Contributor

after implementing i am getting following error:

Runtime error
Traceback (most recent call last):
File "<string>", line 42, in <module>
File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\arcobjects\arcobjects.py", line 867, in cut
return convertArcObjectToPythonObject(self._arc_object.Cut(*gp_fixargs((other,))))
RuntimeError: A polygon cut operation could not classify all parts of the polygon as left or right of the cutting line.

Please help!!

0 Kudos
FC_Basson
MVP Regular Contributor

Seems like the cutting line is not intersecting with the polygon.  Is the spatial reference of the polygon also 4326?

0 Kudos
AlexMarczynski2
New Contributor

Has there been any advancements to this error? I am attempting to use the script but am coming back with the same error as Vaibhav. I have changed the SpatialReference to my data.

0 Kudos