Take the 2-minute tour ×
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 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
add comment

1 Answer 1

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. –  baens Jun 7 '12 at 21:37
add comment

Your Answer

 
discard

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.