9

First, I have a shapefile consisting of square grids and each grid has an ID. Second, I have a shapefile consisting of different zones (with IDs).

A grid ID in the first shapefile can contain many zone IDs from the second shapefile.

I want to know what is the dominant zone ID inside a grid and record that in a table. I only want to know the dominant zone (in terms of the area) and not the rest of the zones intersecting that grid. In the end, I would want a 2-column table with all the grid IDs in the first column and the corresponding dominant zone ID (or the largest zone in terms of area) in the second column.

Here is a sample figure. By just looking at the figure, I could tell that in Grid ID 1, the dominant zone/area is Zone ID 1. In Grid ID 2, the dominant zone/area is Zone ID 2. And in Grid ID 3, the dominant zone/area is Zone ID 3. I would like to have a table with two columns, with each grid showing only the ID of the dominant area.

enter image description here

0

2 Answers 2

8

INPUT:

enter image description here

After dissolving zones use following WORKFLOW:

arcpy.Intersect_analysis("GRID #;ZONE #","D:/Scratch.gdb/intersect")
arcpy.Sort_management("intersect", "D:/Scratch.gdb/sorted","Shape_Area DESCENDING")
# DELETE MINORITIES USING GRID ID 
arcpy.DeleteIdentical_management("sorted", "ID")

OUTPUT SHOWS "SORTED" AND GRID:

enter image description here

Transfer dominant zone ID to grid layer from "sorted", using join by attributes, if necessary.

Important update a year later: each zone must be a single, potentially multipart polygon. If this is not a case original zones layer must be dissolved by zone name.

0
6

I attempted this with a test dataset. I'm using a geodatabase so that the area is calculated (recommended). If you must use a shapefile, calculate a field with geometry for the shape_area before you do step 2. I have a polygon layer named Poly and a fishnet grid named FNET. Poly has a field (MTYPE) and values of 1 (maroon), 2 (green), or 3 (purple) (colors from the 1st screenshot).

enter image description here

Step 1. Intersect the 2 layers. Intersect Operation

Now the output from that first step gives you FID fields for each layer (in mycase it is FID_FNET and FID_Poly).

Screenshot showing how FID for each is preserved (325 is the grid cell and it has one each of 1, 2, and 3 in it). Screenshot showing how FID for each is preserved

Step 2. SUMMARIZE (sorry the screenshot looks like "Statistics" but use Summarize.

Summarize (showing table)

Step 2 (continued). Do a Summarize on FID_FNET and set it up as in this next screenshot so you are getting a maximum on the Shape_Area field ...

Parameters for Summarize

Step 3. Do a join using the output of the intersect operation and the table (join the table to the intersect) and base the join on the shape_area from the intersect output and the "Max_shape_area" from the table.

The null values can be ignored (they are the ones that were NOT maximum) or deleted (better yet). and the result using the joined table is a list of FID_FNET records that also have an FID_POLY that matches the largest (MAX) value for each grid cell!

This last screenshot shows how I set up the join. JOIN

5
  • I followed every step. I have the intersect file with about 34,000 records. After the step on summarize, I got a table with 30,000 records. When I tried joining them, it only joined less than a 100. I am confused of what happened to the rest. Can ArcMap join this many records?
    – GISnew
    Commented Nov 18, 2016 at 19:55
  • Actually the areas that do not match are the leftover "non-dominant areas" so you should not need to worry about them. If not, they are outside the overlapping area. Commented Nov 18, 2016 at 20:48
  • This is amazing. I wasn't looking for the maximum but this still helped me a lot. I am just wondering, the Shape Area in the summarized table, what is the unit of it?
    – Bowen Liu
    Commented May 23, 2017 at 20:35
  • @AndrewLebron it is (by design) always the same as the horizontal units for the feature class so have a look at the properties of the input. Commented May 24, 2017 at 10:44
  • Thanks a lot. I calculated the geometry as acres before I summarize it. Then it shows up as acres.
    – Bowen Liu
    Commented May 24, 2017 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.