Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am preparing data for inclusion into a geonetwork node, where the maps are displayed via geoserver.

The problem is that cells that have"no data" are displaying as black in the geotiff and I am would like the color to be set to white or transparent.

I am using ArcView and do not have access to either Spatial Analyst or 3D analyst.

I would prefer not to have to assign a new sld file and am presently using "Use colormap" when exporting from ArcGIS Desktop.

share|improve this question

3 Answers 3

up vote 6 down vote accepted

In concept, you need to figure out what pixel values represent cells with no data and then edit your color table to assign the RED,GREEN,BLUE (RGB) values in the color table to be 255,255,255 for that cell value.

If you don't have the appropriate license to do this in Arc, you could use the gdal_translate tool (one of the gdal/ogr commandline tools)

  1. export the color table for your tif as an XML file.
    gdal_translate -of VRT myImage.tif outColorTable.vrt

  2. open up the .vrt file in a text editor and find the entry for the value of your no data pixels. There isn't an index number for the cell values, so you have to count down to the correct entry.

  3. edit this value to be <Entry c1="255" c2="255" c3="255" c4="255"/>

  4. now, create a new tif based on the new color table
    gdal_translate outColorTable.vrt newCorrected.tif

(example added based on comment below)

When I run the command in item #2 above and open up the .vrt file in a text editor, I see XML contents.

Part of the file includes lines that look like this, I have snipped most of them out.

share|improve this answer
Hi DavidF. Thanks fot the answer which I have been trying to carry out with FWTools (a bit easier to navigate for the novice). But I am having trouble finding the "value" in the vrt file because when I open the file with notepad their are now discernable words and it is composed mainly of random (code) text. Am I doing something wrong? - any additional help greatly appreciated. – enmapping Oct 27 '10 at 20:01
@user1106 - Try the above commands again, I had left out output format option. It should work now! – DavidF Oct 27 '10 at 21:19

I wrote a small gdal python script for this,, a simple command line program to set specified raster value NODATA, without creating a new raster. The easiest route to installing GDAL on windows is via OSGeo4W. Examples:

python foobar.tif 0            # pure black is transparent
python foobar.tif 0 255 0      # pure green is
python foobar.tif 50 23 77 100 # arbitrary value in 4 band image

If you don't mind some processing overhead and creating a new image rather than editing in place there is also gdal_calc which allows actually changing the cell values rather than just updating the metadata.

Set values of zero and below to null: -A input.tif --outfile=result.tif --calc="A*(A>0)" --NoDataValue=0
share|improve this answer
Nicely done Matt! – DavidF Oct 26 '10 at 18:31
Does this really answer the question? Your (nice!) script will set a color to NULL, but I guess it is still WMS-implementation specific, in which color (let's say transparent is a color, too) the NODATA values are rendered. – alfonx May 14 '11 at 13:27
@alfonx, yes there's a difference between a cell that's recorded as nodata and cell that says I am 0 and the application decides whether it or some other value should be ignored. ArcGIS does respect the results of; I've no experience with GeoServer. – matt wilkie May 16 '11 at 19:27
Looks like it's moved again, now at:… – Steve Bennett Apr 4 at 2:21
link fixed, thanks for note! @SteveBennett we should delete these meta comments now. – matt wilkie Apr 22 at 17:48

Besides that you preferred NOT to create a new SLD file, here is a blog entry on how to convert the internal colormap of a GeoTIFF to a SymbologyEncoding/SLD and define another colour there. In the derived SLD it is easy to define exactly which values to render with a 100% transparent color.

share|improve this answer
there is no link in your text. – matt wilkie May 16 '11 at 19:21
thanks.. a formatting error. link now added – alfonx May 24 '11 at 13:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.