1

I made a shapefile into 1,040,000 grids by the tool, create fishnet. This shapefile has an attribute table including 7 fields and 1,040,000 rows. What I want to do is to make a model which can let me get some "values" that I would like to extract.( I am sorry that I don't know how to describe these "values" in a sentence. I will explain it in the following description.)

Its fields are like this:

Aspect (Long): (with values) 1, 2, 3, 4, 5

Slope (Long): (with values) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Curvature (Long): (with values) 1, 2, 3, 4, 5, 6, 7

Rainfall 1hr (Double): (with values) 89.9, 100, 120, 140, 160, 160.1

Geology (Text): (with values) RockA, RockB, RockC, RockD, RockE

Distance (Long): (with values) 0, 1000, 2000, 3000, 4000, 5000

Rainfall 3hr (Double): (with values) 239.9, 320, 400, 480, 560, 640, 720, 800, 800.1


I am trying to fill in the tables below(this picture does not include all the tables that I want to fill in. It is just part of all the tables): Tables

For the yellow cell in the first table. I should fill in the row number,or you can say the grid number, with attribute "Aspect = 1" and "Slope = 1". For other cells in those tables, they have the same meaning.

I will do this search for all the 7 fields two by two. So, I will need to complete [(6+1)*6]/2 = 21 tables.


Up to now, I have built a simple model that uses tool Select Layer by Attribute, Get Count, and Collect Values. By using this simple model, I can get the values of a column in one search. But I think it is still too time-consuming. enter image description here

The below pictures indicates the values extract from one of my model. After running my model I will type these numbers into my table by hands. Results of one of my model

I am also curious if one can extract these values into .txt or excel files. Then, it will be much easier and convenient for me. I know there is a similar question here(Exporting data from Collect Values output in ArcGIS ModelBuilder?). I have tried it successfully. However, I can only get the values for "one column" written for each search, similarly. enter image description here


I hope someone could teach me how to do this search more efficiently, such as getting the values for two fields in one search.

I hope my explanation is clear enough. Any suggestions are welcome.

2

One solution is to create a field filled with "1" then use pivot table with, e.g., Aspect as the input field, slope as pivot field and your "1" as value field. However, you'll need Advanced (ArcInfo) licence for this tool.

A workaround is to create a new field where you concatenate 2 fields ( str(!slope!) + "_" + str(!Aspect!) ), then you use summary statistics based on the new field and it gives you the count for each combination.

  • Hi, radouxju! I have tried the two solutions you suggested. I have the ArcInfo license, so it won't be a problem. I think I will need to read more about how pivot table works. As its result is not understandable for me. However, your second solution works really well. I will save a lot of time by doing so. Thank you very much. – NewHere Sep 23 '15 at 8:20
2

Infact, you will not have the table structure showed above- i think they are from using excel? You can use exporting attribute table into text format like csv etc and process them in excel, there you can use many ways to go e.g. Power Query Add In, Pivot Table building etc and importing back into arcgis . If you want to do it in arcgis then you can use Pivot Table tool, but with limited performance.

Hope this helps.

  • Yes, those table are from Excel. The main point of my question is to find a better way to get those values. Thank you for your answer! I will try to figure out the ways you suggested. – NewHere Sep 22 '15 at 7:58

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.