0

I'm trying to use the Tabulate Area tool in ArcGIS Pro (version 2.2.1) to cross tabulate two rasters: one raster of zones (where value = true crop type) and a second raster is a supervised classification output (which contains a field called Class_Names which are the classes).

The tool successfully generates an output table, but it truncates the field names (which are my classes, and I need the whole name).

How can I create this table without field names being truncated?

Here's a snapshot of my output table:

enter image description here

I've run the tool in the GUI. I also ran it in the python window and set arcpy.env.qualifiedFieldNames = False, but it still capped me at 16 characters for field names:

import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.env.workspace = 'Q:/data/IID_T2_2016.gdb'
TabulateArea(in_zone_data = 'iid_t2_2016_bad00', zone_field = 'Value', in_class_data = 'iid_t2_2016_agsup00', class_field = 'Class_Names', out_table = 'tableTestv4')

For context, here's my overall mission in case there's another route:

I'm trying to replace a workflow previously completed with ERDAS IMAGINE's Summary Report of Matrix tool, which creates a cross-tabulation report comparing the same two rasters: zones (a raster of incorrectly classified crop fields -- with values in this case of the known ground truth crop type ranging from 1-34) against classes (a pixel-scale supervised classification raster -- in this case with a very long signature class name, e.g. 8084-145-5.01-20-9-1). The resultant output table was essentially a frequency table. It broke up the percentage of each zone's total area by each class.

Here's a snap shot of the first few lines for Zone 1:

Here's a snap shot of the first few lines for Zone 1:

  • What were all tools/functions and parameter values that you used in the Python Window? – PolyGeo Dec 31 '18 at 22:29
  • Are they field names or field aliases? Your input is a raster which has a raster attribute table, in ArcGIS this is a dbf for file system raster and has a limit on field names. It is quite likely that when the raster was classified the fields were given aliases to circumvent the field name limits, field aliases are not copied. – Michael Stimson Dec 31 '18 at 22:32
  • Thanks-- It appears that the field name is identical to the alias for all fields in the supervised classification .img raster. updated_field_names = [field.name for field in arcpy.ListFields(dataset = 'iid_t2_2016_agsup00.img')] ; updated_field_names returns ['OID', 'Value', 'Count', 'Red', 'Green', 'Blue', 'Opacity', 'Class_Names', 'Crop'] – Iracambi Dec 31 '18 at 23:09
  • Looks like you haven't provided a file output ext and the default is INFO table format, which imposes this limitation - outputting to file gdb provides a 64-char field name length limit, see desktop.arcgis.com/en/arcmap/latest/manage-data/… – T. Wayne Whitley Jan 1 at 18:33
1

1]

From http://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/tabulate-area.htm.

Of course, if you need an output table as text (csv or txt), from the gdb table as input, you may output this as text using Table to Table or Copy Rows (or script it yourself with cursor processing and native Python modules).

  • Thanks, I had tried all three and the lengths were truncated as: .dbf (10), INFO (16), and oddly a table within a .gdb was also truncated at (16) and I can't figure out why. I updated the code block above to show that I'm setting my workspace to a file geodatabase. – Iracambi Jan 2 at 0:06
  • And did you say you checked the input for already truncated field names? If not, for a workaround you could set up some sort of LUT on field names with a key truncated to length 16, provided those truncated names are still unique. Provide a text field containing the actual corresponding field name - then post-process your Tabulate Area output to add the correct field name (or join, whatever suits you best). – T. Wayne Whitley Jan 2 at 0:33
  • 1
    Not a join, sorry I misspoke, but a means to rename fields (or provide aliases) in the post-processing step using the LUT created. Alternatively, you could use cursor processing to populate a new table you set up with the corrected field names - just match the truncated field names to the key values in your LUT. Probably a python dictionary is best for this - not sure if you have that experience? – T. Wayne Whitley Jan 2 at 1:06
  • Thanks, yep I was thinking of a dictionary with your last post. I'll give that a try and report back (I may also hop to R- it looks like step 7 of this tutorial shows the R version of Tabulate Area. zevross.com/blog/2015/03/30/map-and-analyze-raster-data-in-r/… – Iracambi Jan 2 at 1:32
  • Also, I double checked and the input fields don't appear to be truncated (Class_Names is Field Name and Alias is Class_Names too). It's all of the values from this field that become new Fields in the output (almost like a pivot table in Excel). The field is a Text data type with length of 255 if that's helpful at all... – Iracambi Jan 2 at 1:36

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.