Ask A Cartographer

Importing GRASS Color file into ArcGIS

October 13 2010 | 2 comments
Categories: ArcGIS Methods, Symbology

I'm trying to recreate a color file for some raster files. I have a color file from GRASS that is basically a list of value ranges with associated RGB codes.

I need to use this for several rasters (one for each month) and I'm looking for a simple way to do this instead of re-creating it every time. I've tried making unique values, but it won't let me create a colormap (option grayed out). I've tried copying in the symbolagy from one month, but the values are different from month to month, and I can't figure out how to get the other months in there.

Is there any way I can do this where I have what is similar to an arc/info Lookup table...?

thanks

Mapping Center Answer:

Because you want to apply the same symbology to different rasters that will have different values, using a color map will be the best option. However, because your data is 32-bit, the color map option is grayed out for you. Color maps can only be created for single-band raster datasets with a pixel depth of 16-bit unsigned or less.

So, you need to convert your grids into 16-bit unsigned data.

But that’s not your only problem – there are two more things you need to fix, and one additional step that we recommend you take.

First, your colormap file cannot have negative values and your first value is -999. So you will either need to make this NoData, which is NOT a negative value, or you will need to assign it some positive value (which I would not recommend). If your data do not contain any values of -999 then the solution is easy – simply delete this row from the colormap file.

Second, you need to understand that there must be a row in the colormap file for a ALL possible values. (This is different from the format of the colormap files we used way back when with Workstation ArcInfo). Although you used to be able to indicate ranges of values, and indeed the colormap file you got from GRASS does the same thing, you have to create a new colormap file that has all the values. So you need to add the missing values.

BUT before you do that, we recommend that you convert the units of the raster values. They are currently in hundredths of mm, so if you divide by 100 to get mm, then the number of missing values that you have to add to the colormap decreases by a factor of 100.

For example, the data for August range in values from 2462 hundredths of mm to 5911 hundredths of mm. If you divide these values by 100, your range is now from 24mm to 59mm, and you only have to fill in any missing values from 24 to 59. Thsi is much easier and faster than filling in missing values from 2462 to 5911.

For example, you could use Notepad to fill in missing values. Or you can create a custom color map file in the Layer Properties dialog box when you are setting the symbology for the raster.  

Once the colormap file is created, you can apply it to a raster using the Add Colormap tool. 

You can automate the process of converting to 16-bit unsigned integer and applying the colormap file using model builder iterators or in Python.

Can colormap have decimial values? posted by Sachin Chand on Apr 11 2011 8:05AM
We have several clr files that we would like to import into a raster, input appropriate symbology and then export that symbology for use with other rasters. The clr files have decimal values and when importing the clr into the raster, the decimal values do not transfer. Below is the format of the clr files.

0 255 200 255
0.5 255 190 255
1 255 180 255
1.5 253 178 253
2 251 165 251
2.5 250 160 249
3 248 150 248
3.5 245 148 245
4 243 145 243
4.5 240 143 240
5 239 140 239
5.5 237 138 237
6 235 135 235
6.5 233 132 233
7 231 130 231
7.5 229 128 229
8 227 125 227
8.5 224 123 226
9 221 120 225
9.5 219 118 223
10 216 115 220
Integers only posted by Aileen Buckley on Apr 11 2011 8:24AM
The value to which the RGB colors are applied must be integer only since color maps can only be used with 8- and 16-bit values.

If you would like to post a comment, please login.

Contact Us | Legal | Privacy |