1

I have a 3-band (RGB) raster file from CORINE and the attribute table hasn't been built. When I try to execute the command BuildRasterAttributeTable I get an error that only single band rasters are allowed. What should I do to get the attribute with the land uses?

Error Message:

ERROR 000423 Only single band integer raster dataset is a valid input

  • 1
    Which software do you use? – SS_Rebelious Dec 11 '14 at 10:15
  • 1
    Would you be able to edit your question to include the exact text of your error message, please? – PolyGeo Dec 11 '14 at 10:49
  • 1
    Land cover is usually categorical and not continuous data, so I'm not sure why it would be 3-band. Would you be able to split it into individual bands and build an attribute table on that? – Wes Dec 11 '14 at 13:49
  • 2
    What are the three attributes/bands? As Wes says, it's usually categorical data (I disagree on continuous, but that's semantics between location and value range - I understand the intent). I suspect you don't have an actual CORINE raster - you have an RGB of CORINE data. This means the actual raster has been converted to an RGB using a renderer. The values in said raster don't represent landcover, they represent colors, which are then keyed to a legend which is based on what the actual CORINE raster values are. If so you need the original raster or will have to convert what you have. – Chris W Dec 11 '14 at 22:28
  • 1
    There are ways to do what you want, but my first recommendation would be to find the original CORINE data (a single band raster where cell values are already coded to land use). I've nominated the question for reopening, and if/when it is I can outline a process to get what you want. Surprisingly I couldn't find a similar question here and it is a good one. The short version is you're going to have to use raster calculator to combine those three bands, likely do some cleanup due to lossy jpg compression, and then reclassify to simplify the values. Then you can build your attribute table. – Chris W Dec 12 '14 at 20:09
1

As the error message states, you cannot have an attribute table for a multi-band raster. The attribute would be tied to the combination of all three bands, not just a single value. I'll also point out that the raster must have integer values - float or double won't work. Be careful with input data types (may have to be converted) and any choices made along the way when adding or exporting.

The ideal solution would be to find original CORINE data. It should be a single band raster where each cell has a numeric value corresponding to a land cover type - for example 2, 15, or 7. It would probably already have an attribute table and include a description attribute along with the value.

You have an RGB conversion of that raster via a render. Colors were assigned to each class and the color, not the class, is stored in the RGB raster. Instead of a single cell with a value of 15, there is now one cell in each of the three bands representing the amount of color from that band. 255 R, 0 G, 0 B combined become a red pixel. To get back to the single band raster you have to merge all three bands. Unfortunately with RGB, you can't simply add them together and get the true unique value. 255, 0, 0 (red) and 0, 0, 255 (blue) both sum to 255. If converting to grayscale you could take the average of the three values and get a mean value to use as a brightness, but in this case you need the unique category colors and a legend that tells you what class each color is.

Warning: Always make a backup copy before processing a raster in case something goes wrong. There are two potential problems with your raster in any of the following solutions. First, if there are borders of a different color between the land cover classes in your RGB, those pixels will have their own unique color values that do not fall into a class. Second, if the RGB is of a format that allows and was saved with lossy compression (such as a jpg) there may be severe value artifacts at the borders between classes. For example three pixels that appear red (255, 0, 0) actually come out to be 254, 2, 0, 255, 10, 1, or 253, 0, 0 (this is particularly important in the second method below). Where significantly different colors meet you could get completely different color values - for example purple pixels near red/blue boundaries. This would require extensive cleanup or other methods not covered by this answer.

Method one is to add the RGB bands separately (not all at once, or composite, by adding the file name, but go into the file name and add the individual band) to ArcMap and examine them. While all will display in grayscale, you may find one band where all classes are easily identifiable (meaning for that color band, each class has a fairly distinctive value). If so you can right-click that band and Data > Export it to a separate raster, then run Reclassify to change the values to something more logical such as smaller, sequenced values. However it’s possible that in one band two different classes will share the same value – for example both cyan and yellow have a green value of 255, so those colors/classes would be indistinguishable in the green band. You could examine and export all the bands, run Reclassify to get the ones you can ID in each, and then add all the results together with Raster Calculator to eventually arrive at a single classed raster.

Method two utilizes some processing with the Raster Calculator. Start by adding each band separately as above and export them to their own raster. Take the red band of your image and multiply the values by 1,000,000. Then take your green band and multiply it by 1,000. Now you can add all three bands together. Before a red pixel would have resulted in 255. Now it will result in 255,000,000. This is one way to concatenate the numbers into unique values that each represent a color. In theory each of your land cover classes will have the same unique value. Again, you use Reclassify to change the values to something simpler.

Method three utilizes the Image Classification toolbar (which you’ll probably need to add – Customize > Toolbars). On the toolbar, select the second button from the right – Draw Polygon. Now draw a shape encompassing a few pixels that are definitely in one class (say, the middle of a particular region). Do this for each color/class in your RGB. Then click the leftmost button on the toolbar, Classification, and choose the first option – Interactive Supervised Classification. Alternatively, without drawing the boxes and if you know how many classes you have (plus one for any no data areas) you could try the Iso Cluster Unsupervised Classification first. You should end up with a temporary, single band, classified raster that you can then right-click and export.

The results of any of these three methods would be suitable for building a raster attribute table. Note these solutions will only recover categorical or thematic classed data. The original values of data classified into ranges or even unique values like a DEM cannot be recovered.

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.