# Automatically dividing multiple polygons into halfs

I have this shapefile with multiple polygons (equally sized hexagons). My wish is to divide all hexagons by two. The goal is then to have two layer, one layer with all the left half of the hexagons and the second layer with the other half. If it is left, right, up or down doesn't matter really.

The difficult part for me is to find an automated mechanism that can handle this.

The purpose for this procedure is that I want to display two different values for the same hexagon. Therefore, my idea was to separate it like this.

• Do you want to cut the polygons down the middle or separate them out into left and right? Think of selecting half of them and exporting the selection (so no polygon is actually "cut") Commented Jun 5, 2020 at 13:20
• @Hornbydd I'd like to cut each hexagon into two parts, the angle of the division is secondary. So, in the end, I'd have double the amount of features.
– Yves
Commented Jun 5, 2020 at 13:26
• You might be able to adjust my answer here if you are ok with using python: gis.stackexchange.com/questions/231997/…
– Bera
Commented Jun 5, 2020 at 15:34
• @BERA Great tool, I think iterating it over all hexagon will do the work (it cut it in a diagonal manner). Please post it as an answer. Commented Jun 5, 2020 at 15:52

Very simple solution possible in this case, because it's enough to find pair of vertices that will split hexagon in equal parts:

``````FeatureVerticesToPoints(in_features="HEXAGONS", out_feature_class="C:/SCRATCH/points.shp", point_location="ALL")
SelectLayerByAttribute(in_layer_or_view="points", selection_type="NEW_SELECTION", where_clause='mod( "FID",7) in (0,3)')
PointsToLine(Input_Features="points", Output_Feature_Class="C:/SCRATCH/CUTS.shp", Line_Field="ORIG_FID", Sort_Field="", Close_Line="NO_CLOSE")
``````

Output:

To get one of 2 possible diagonal splits use " in (1,4)" in selection query.

This seems like an obvious tool that ArcMap should have but it does not exists (to my knowledge) as a geoprocessing tool. Splitting polygons can be done in edit mode but not straight out of the box in a mass automated way.

Do you think you are the first person to have ever wanted to split a polygon in half...no! When you are using ArcMap and you think of such a process then someone else has almost certainly done it before. So you should be heading over to the community driven website codesharing.

Need to create those bisecting lines then I have personally uploaded the Create Lines By Bearing tool but this relies on you having a centroid dataset which easy to create from your data or searching the codesharing website you can find the Polygon Bisector tool.

Note some of these tools require advance license level which you do not state if you have in your question (you should always do that, including version of ArcMap).

With these tools you will be able to split your hexagonal polygons in half.

• I think getting centroids for this task is too heavy and require licensing. Using the coordinates of points and do some math is fair simple (at least in this case). Is any other reason (Coordinate systems or something) to do it that way? Commented Jun 5, 2020 at 15:46

I see you are using ArcGIS but my sugestion will work in any enviroment that let you write a program (as a script or diagram).

1) Extract all point coordinates (as a table maybe)

2) Keep the first (x) coordinate and delete all repeated entries

3) Save a maximun and minimun second (y) coordinates wich encapsule the full hexagon maps, it could be from the extracted table or custom

4) Order the (x) coordinates of 3rd step and find the medium points pairwise: [x(n)+x(n+3)]/2; be carefull here to keep only the odd obtined medium points

5) Draw lines with dose x coordinates from ymin to ymax

6) Split the poligons using these lines

Maybe it look as a heavy way of doing "a simple task" but it is not so dificult as it appear, and, besides, is a program you can use everywhere and you can easily adapt it to other simmilar problems.

• You can also program this just for one poligon and do a loop for each poligon, in that manner changing step 4 formula by a mean sum(x)/pointnumber you can work with other paps of poligons than are not hexagons Commented Jun 5, 2020 at 15:40