# Extract polygon attributes from covering polygon with highest area

I have a fishnet grid (polygon layer) and another polygon layer containing some hexagons. I would like for each square polygon in the fishnet layer that covers a hexagon (even a tiny edge of it) to take the name attribute of the hexagon. If more than one hexagon touches a square polygon, I want the square polygon to take the name of the hexagon which covers the highest area within that square.

I’m thinking something like:

``````gp.SpatialJoin_analysis(Fishnet, Hexagons, Output1, "JOIN_ONE_TO_ONE", "KEEP_COMMON", "Name 'Name' true true false 12 Text 0 0 ,First,#,Hexagons.shp,Name,-1,-1", "INTERSECTS", "0 DecimalDegrees", "")
``````

How can I replace “INTERSECTS” with a different rule i.e. hexagon with largest area?

A spatial join analysis may not be the best analysis here and I’m open to suggestions. I’m using ArcGIS 9.3 and python 2.5.

Thanks

## 1 Answer

Use a spatial join but a ONE TO MANY relationship. So if a square intersects say 3 hexagons then you get 3 squares back one for each hexagon. Then use the Summary statistics tool to group by square ID and select MAXIMUM hexagon area and first hexagon ID. This creates a table of square ID, maximum area of hexagon and hexagon ID. Then its a sequence of joins to pass the Name of the hexagon to your fishnet dataset.

• I like the idea. However, I have some tweaking to do with the summary statistics as using first hexagon simply gives me the first hexagon name in the alphabet per square ID instead of the hexagon name associated with the max area. I have not found a solution to that yet . . . will work on it tomorrow. – JoeBird Oct 8 '14 at 5:28
• Finally got it to work. I was lucky that the hexagon names are numerical so I combined them with the area to form a numeric value "area.name" then used the summary statistics to obtain the max area by square ID. It was easy to then re-extract the name from the attribute area.name. – JoeBird Oct 8 '14 at 16:41