CreatePixelBlock fails in loop

Discussion created by rohitp on May 5, 2010
Latest reply on May 6, 2010 by rohitp
I am trying calculate values and update a large raster (11021 * 10643)  of type Int32. Since I get an error ("the input string is not a geographic or projected coordinate system") if i try to read the whole raster, I am doing this by splitting the raster into 4 parts and performing calculations. The first iteration runs fine and the output raster is correctly updated, however in the second iteration error occurs on the last line of the following code where it creates a pixelblock3 on output raster(other rasters which are of the same size as the output do not get this error).  Am i doing something wrong?

Is it better to read the raster lengthwise (few rows at a time)?

 for (int block = 0; block < 4; block++)
                    int shire = 13;
                    DblPnt blockStart = new DblPnt();
                    DblPnt blockExtent = new DblPnt();
                    blockExtent.SetCoords(pEUCProps.Width / 2, pEUCProps.Height / 2); 

// 5510* 5321 is the extent of block which corresponds to 1/4 of the cells in complete raster. 
// If i reduce the extent to 5500 * 5300 I still get error while creating pixelblock of output in 
//second iteration

                    switch (block)
                        case 0:
                            blockStart.SetCoords(0, 0);
                        case 1:
                            blockStart.SetCoords(0, pEUCProps.Height / 2);

                        case 2:
                            blockStart.SetCoords(pEUCProps.Width / 2, 0);

                        case 3:
                            blockStart.SetCoords(pEUCProps.Width / 2, pEUCProps.Height / 2);

                    IPixelBlock pEUCBlock = pEUCRawPixels.CreatePixelBlock(blockExtent);
                    pEUCRawPixels.Read(blockStart, pEUCBlock);

                    IPixelBlock pZonesBlock = pZonesRawPixels.CreatePixelBlock(blockExtent);
                    pZonesRawPixels.Read(blockStart, pZonesBlock);

                    IPixelBlock pBuildableBlock = pBuildableRawPixels.CreatePixelBlock(blockExtent);
                    pBuildableRawPixels.Read(blockStart, pBuildableBlock);

                    IPixelBlock3 pOutBlock = (IPixelBlock3)pOutRawPixels.CreatePixelBlock(blockExtent);