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 from ERDAS IMAGINE (containing a field called Class_Names which are the classes).
The attribute table of my supervised classification (i.e. the classes input for the Tabulate Area Tool) looks like:
The tool successfully generates an output table, but it truncates the field names (i.e. my output table should have a field for select values from the Class_Names field of the supervised classification attribute table pictured above-- but the names are cut off and oddly enough start with A_).
How can I create this table without field names being truncated?
Here's a snapshot of my output table:
My code is:
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 from the ERDAS IMAGINE output:
Do you get the same results if you try the same operation in ArcMap?
Thanks Michael, yep I get the same result exactly.
This geoprocessing tool comes from the Spatial Analyst team.
I've forwarded it to them - hoping they can give you a viable workaround.
https://community.esri.com/community/gis/analysis/spatial-analyst
Cody B.
Thank you!
With many legacy file formats, field names are limited in width. Also in ArcGIS everything (including field names) are not valid when they start with a number, so the tool is inserting the A_ to make the field names valid.
I think the easiest solution is to create a new field with simpler field names (<14 characters, start with a letter) and use that instead of the unwieldy values you have in Class_Names.
Validating table and field names in Python—ArcPy Get Started | ArcGIS Desktop