I'm using the new IRawBlocks in ArcGIS 10 from the adopted sample in ArcGIS 10 SDK help and I want to create a custom sized pixel block that feeds me a block of values column by column instead of a block. So basically I'll be looping through each column in the raster. Any ideas as I couldn't find anything in the documentation?

        IRawBlocks rwBlocks = (IRawBlocks)rb;
        IRasterInfo rsInfo = rwBlocks.RasterInfo;
        IPixelBlock pb = rwBlocks.CreatePixelBlock();

        // change pixel blocks size here?????

        // iterate through pixel blocks
        for (int pbXcursor = 0; pbXcursor < rsProps.Width; pbXcursor++)
            string line = "";
            rwBlocks.ReadBlock(pbXcursor, 0, 0, pb);

            // iterate through cells in pixel block, should only be one pixel column
            for (int pbHeight = 0; pbHeight < pb.Height; pbHeight++)
                object val = pb.GetVal(0, 0, pbHeight);//pbWidth, pbHeight);
                // etc
  • Did you try IPixelBlock4.Create and set nCols to 1? – Kirk Kuykendall Sep 20 '11 at 13:41
  • Just have but it seems to be reading from a weird location in the raster (haven't quite found where!). IPixelBlock pb = (IPixelBlock)rwBlocks.CreatePixelBlock(); IPixelBlock4 pb4 = (IPixelBlock4)pb; pb4.Create(1, 1, rsProps.Width, rsInfo.PixelType); – Rob Sep 20 '11 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.