p.kennedy@fugro.com.au

Problems with rasterdataset NoData Value

Discussion created by p.kennedy@fugro.com.au on Dec 7, 2013
Latest reply on Sep 8, 2014 by keitheweber
Morning,
Using ArcGIS 10.1 Build 3035...

I am having terrible trouble setting a NoData value for a file geodatabase rasterdataset with ArcObjects.  I create the rasterDataset, and populate the pixels without trouble.  I set the NoData to -9999, which is my preferred nodata value.

        //http://forums.esri.com/Thread.asp?c=93&f=993&t=258752
        private IRaster getRaster(IRasterDataset rasterDataset, float noDataValue)
        {
            // Create a raster in the dataset; also add a bands collection
            IRaster rc = new RasterClass();
            IRasterBandCollection rasterBC;
            rasterBC = (IRasterBandCollection)rc;
            rasterBC.AppendBands((IRasterBandCollection)rasterDataset);

            // Now set the raster properties
            IRasterProps resultProps = (IRasterProps)rasterBC.Item(0);

            // assign the NoDataValue and return
            resultProps.NoDataValue = noDataValue;
            return rc;
        }


There are no errors thrown, so I assume all is well.

I then look at the properties of my new rasterDataset in ArcCatalog.  All settings are fine OTHER than the NoValue. Hmm.  I have been tearing my hair out trying to make this value get saved into the FGBD.

To try and find my mistake, using ArcCatalog, I manually created a new FGBD, then manually created a new RasterDataset (picel type: floating point, and set the NoData value to -9999.  It appears to accept the value, but if I then F5 to refresh the geodatabase, and check the raster settings, the noData value is blank.

Hmm.

This leads me to believe there is a problem setting the novalue field in ArcGIS10.1 when using a file geodatabase.  It is not just in ArcObjects, but also in ArcCatalog.

I trawled thru the forums, and can see others have had this problem, but there is nobody with a clear solution which actually works.  Indeed, if it does not manually work in ArcCatalog, then ArcObjects has no chance.

Can anyone help?

Outcomes