AnsweredAssumed Answered

strange rusult from ImapAlgebraOperation

Question asked by matoretta on Mar 14, 2011
Hi i have problem using mapAlgebraOperation in my code. if I use it in my code there is different result than when i use it in ArcMap. (see attachment ma1.jpg vs ma2.jpg). At first a create raster whit value 1, after that i change it using IpixelBlock

pPixelBlock.PixelData(0) = CType(pFAArray, System.Array)
        ' Write the pixeldata back
        Dim pRasterEdit As IRasterEdit
        pRasterEdit = CType(pFARaster, IRasterEdit)
        pRasterEdit.Write(pTLC, pPixelBlock)


        ' Get RasterBandIn from the raster
        Dim pRasterBandIn As IRasterBand
        Dim pBandColIn As IRasterBandCollection
        pBandColIn = pFARaster
        pRasterBandIn = pBandColIn.Item(0)
        Dim stat As IRasterStatistics
        stat = pRasterBandIn.Statistics
        stat.Recalculate()

than i use MapAlgebraOperation

        pMapAlgebraOp.BindRaster(pFARaster, "FlowAcc")
        pFlowAcc = pMapAlgebraOp.Execute("CON([FlowAcc] <> 0, [FlowAcc])")
        pMapAlgebraOp.UnbindRaster("FlowAcc")
        pMapAlgebraOp = Nothing

so when i Use MapAlgebraOperation like this i have result ma1.jpg,  when i create whole raster and than use raster calculator i have correct result ma2.jpg..
do you have any suggestion ???  thanks a lot.

Attachments

Outcomes