Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
            }
        }
share|improve this question
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.