8

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

  • Hi @BERA. I added a sample figure to illustrate my point. Thanks. – GISnew Nov 14 '16 at 18:16
  • 1
    Please be aware of your options when a question does not have an answer: meta.gis.stackexchange.com/q/4010/115 Re-asking the same question should not be done because the philosophy of the site is to only have each question answered in one place. – PolyGeo Nov 14 '16 at 21:38
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.

6

Ok I think I follow the question. I attempted this with a test data set. 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

  • Thank you so much @jbchurchill. I will try it on my dataset and will let you know later if it works. – GISnew Nov 15 '16 at 16:09
  • 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 Nov 18 '16 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. – jbchurchill Nov 18 '16 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? – AndrewLebron May 23 '17 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. – jbchurchill May 24 '17 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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