1

I've got a polygon feature class with attributes fields y2010, y2011, y2012, y2013, y2014, country

The 'year' fields contain counts of an event occurrence, which can be 0 or > 0. The 'country' field' is an identifier for country A or B, so the table looks like this:

y2010 | y2011 | y2012 | y2013 | y2014 | country

   0  |  10    |   1   |   0   |   5   |   A
   1  |   0    |   3   |   0   |   5   |   A
   0  |   1    |   1   |  45   |  20   |   B

I'd like to reformat this table to show per year the number of features that fit certain criteria. The criteria are:

  1. More than zero event occurrences for countries A+B;
  2. More than 1 event occurrences for countries A+B;
  3. More than zero event occurrences for country A.

so that the final table using the example above would looks like:

criterium | 2010 | 2011 | 2012 | 2013 | 2014 |
   1           1      2      3      1     3
   2           0      1      1      1     3
   3           1      1      2      0     2   

and the table content of columns 2:6 would be the number of features of the original table, that meet the criterium for that specific year.

I've been toying around with the Statistics toolset, but so far without success. Any tips are welcome.

Edit: Opted for Q&D solution by exporting the attribute table to R and wrote a script to calculate the cell values.

  • Will your table only every have 2 countries? – Hornbydd Aug 6 '14 at 13:59
  • Yes, the expected output is correct. Thanks for edit. As it is now, my data has 4 different countries, but I'm only interested in 2 options: country A or NOT country A. – HDR Aug 6 '14 at 14:10
2

If it were me...

This could be done in a model but it would be a bit fiddly. I think this would be much easier to write in Python.

You would essentially query your data 3 times one for each criteria get a count and insert the count into a table.

So you need to be looking at the help file at how to use arcpy's SelectLayerByAttribute_management(), GetCount_management() and InsertCursor() (ArcGIS 10.0 or earlier) or da.InsertCursor() (ArcGIS 10.1+) functions to achieve this.

  • Hi,thanks for your answer. You're right that it's too cumbersome for a model. I've exported the Att. table to R and solved it there. – HDR Aug 7 '14 at 12:06

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.