Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to change the a raster's NoData value with ArcObjects and keep coming up short.

Here is the code that I thought would work:

IRasterDataset _dataset = ...get the dataset...
object[] noDataValue = ...set the no data values by raster band...
var rasterbandCollection = (IRasterBandCollection) _dataset;
for(int i = 0; i < rasterbandCollection.Count; i++)
    ((IRasterProps) rasterbandCollection.Item(i)).NoDataValue = noDataValue[i];

This value persists during the ArcMap session, but does not save the changes to disk it appears. Any ideas on how to make this permanent (without having to save a second raster dataset)?

share|improve this question
up vote 2 down vote accepted

If you read the Help on the IRasterProps Interface is says

These modifications only affect the in-memory raster representation and in no way change any of the raster dataset. You can persist the modifications to a new raster datast using ISaveAs::SaveAs or IRasterBandCollection::SaveAs

So you can't just change it without creating a new raster dataset.

share|improve this answer
I did read that and thought that was applying to a in memory instance (which I was hoping to get around by going with the raster band). That is probably the answer, was just wishing it wasn't. – Erik L Jun 7 '12 at 21:37

if you set nodata in a rasterdataset store in disk you can change the nodata permanent

                    rasterBandCollection = rasterDataset as IRasterBandCollection;
                    rasterBand = rasterBandCollection.Item(0);
                    rasterProps = rasterBand as IRasterProps;

                    rasterProps.NoDataValue = -9999; 
share|improve this answer

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.