matoretta

IRasterBand.ComputeStatsAndHist() .. Attempted to read or write protected memory

Discussion created by matoretta on Nov 19, 2013
Latest reply on Nov 25, 2013 by Paritoshg
Hi I have one very strange error when i try compute statistics for my Raster (only happens whit FGDB Raster). It happens when i overwrite raster (when i create new raster everything is OK). Any Ideas? thanks

            Dim pRasterCol As IRasterBandCollection
            pRasterCol = pRaster
            Dim pBand As IRasterBand
            pBand = pRasterCol.Item(0)
            pBand.ComputeStatsAndHist() 'ERROR

ERROR = "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I create raster like this>

Dim copyRaster As ESRI.ArcGIS.DataManagementTools.CopyRaster = New ESRI.ArcGIS.DataManagementTools.CopyRaster()
            Dim gp As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor
            gp.OverwriteOutput = True
            gp.AddOutputsToMap = False

            copyRaster.in_raster = pRaster
            copyRaster.out_rasterdataset = pOutputPath
            copyRaster.nodata_value = -9999
            copyRaster.pixel_type = "32_BIT_FLOAT"

            gp.Execute(copyRaster, Nothing)
            gp = Nothing
            copyRaster = Nothing

Outcomes