Hi i have problem whit writing data from pixelBlock back to Rarter..can anybody help me? I use AG 9.3 and VB.Net VS 2008,,,
Dim pRWS As IRasterWorkspace2
Dim pWSF As IWorkspaceFactory
pWSF = New RasterWorkspaceFactory
pRWS = pWSF.OpenFromFile("C:/", 0)
Dim pRasterDS As IRasterDataset2
Dim pDownLeftX!
pDownLeftX = pRasterProps.Extent.XMin
Dim pDownLeftY!
pDownLeftY = pRasterProps.Extent.YMin
Dim pOrigin As IPoint
pOrigin = New Point
pOrigin.PutCoords(pDownLeftX, pDownLeftY)
pRasterDS = pRWS.CreateRasterDataset("Dem", "GRID", pOrigin, pSirka, pVyska, pRasterProps.MeanCellSize.X, pRasterProps.MeanCellSize.Y, 1, rstPixelType.PT_FLOAT, pSpatialReference, True)
' Create a default raster and QI raster properties interface
Dim myAcc As IRaster
myAcc = pRasterDS.CreateFullRaster
'***************************************** ZAREZANIE RIEK
Dim pSizeIn As IPnt
pSizeIn = New Pnt
pSizeIn.SetCoords(pSirka, pVyska)
Dim pPixelBlock As IPixelBlock3
' Get RasterBandIn from the raster
Dim pRasterBandIn As IRasterBand
Dim pBandColIn As IRasterBandCollection
pBandColIn = myAcc
pRasterBandIn = pBandColIn.Item(0)
Dim pRawPixelIn As IRawPixels
pRawPixelIn = pRasterBandIn
pPixelBlock = pRawPixelIn.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
pRawPixelIn.Read(pTLC, pPixelBlock)
' definicia pola pre Flow Acc
Dim pDemCorr As Object
pDemCorr = pPixelBlock.PixelData(0)
*
*
** change value in PDemCorr
*
*
' Write the pixeldata back
'Dim pCache As Object
'pCache = pRawPixelIn.AcquireCache
pRawPixelIn.Write(pTLC, pPixelBlock)
'pRawPixelIn.ReturnCache(pCache)
' pCache = Nothing
'pRawPixelIn = Nothing
So I create PixelBlock and Array of raster values...change some values and try write it back..but my output raster is not Valid every value is Nodata...do you know where is a problem?? thanks a lot