matoretta

raster edit (create) problem

Discussion created by matoretta on Dec 2, 2010
Latest reply on Dec 5, 2010 by matoretta
hi i have two problems when i create new raster from old one. 1) when all my edit is done the new raster and old raster has the same values (in TOC, Maps) refresh doesn´t help. I must close ArcMap and open it again and when I load old raster again it has different values according to new one.. (the old values - right values). I create new raste from old raster using IClone, after that I work only whit new raster, so I dont understant why also my old raster is changing.. 2) when i Use rasterproperties.setNodata= -9999, new raster is correct Nodata is show in Map as noData (Identity dialog, symbology) but old one hasn´t nodata values but -9999.. i am little bit confuse about this.
thank for your advice MM.

            Dim myDem As IRaster
            Dim pClone As ESRI.ArcGIS.esriSystem.IClone
            pClone = pDemRaster ' here i create new raster from old one
            myDem = pClone.Clone

            Dim pRasterProps As IRasterProps
            pRasterProps = myDem
            pVyska = pRasterProps.Height
            pSirka = pRasterProps.Width
            pRasterProps.NoDataValue = -9999

            Dim pSizeIn As IPnt
            pSizeIn = New Pnt
            pSizeIn.SetCoords(pSirka, pVyska)
            Dim pPixelBlock As IPixelBlock3
            pPixelBlock = myDem.CreatePixelBlock(pSizeIn)

            'Define the starting pixel in pixel space to read
            Dim pTLC As IPnt
            pTLC = New Pnt
            pTLC.SetCoords(0, 0)

            'Read the pixel block from a band
            myDem.Read(pTLC, pPixelBlock)

            ' definicia  pola
            pDemCorrArray = CType(pPixelBlock.PixelData(0), Single(,))

***some code when i change value in pDemCorrArray

            pPixelBlock.PixelData(0) = CType(pDemCorrArray, System.Array)
            ' Write the pixeldata back
            Dim pRasterEdit As IRasterEdit
            pRasterEdit = CType(myDem, IRasterEdit)
            pRasterEdit.Write(pTLC, pPixelBlock)
            ' Get RasterBandIn from the raster
            Dim pRasterBandIn As IRasterBand
            Dim pBandColIn As IRasterBandCollection
            pBandColIn = myDem
            pRasterBandIn = pBandColIn.Item(0)
            Dim k As IRasterStatistics
            k = pRasterBandIn.Statistics
            k.Recalculate()

Outcomes