al3cs

delete from raster data

Discussion created by al3cs on Sep 25, 2012
Latest reply on Sep 26, 2012 by Hornbydd
hi,

I'm trying to delete rows from raster.
The problem is when I delete the rows from atribute table I don't get "NoData" for that row.
I tried to delete pixel blocks that have no data but it doesn't work.

Here's my code:

               //selectedFeatures is a List<IRow>
               //table is raster atribute table
               foreach(IRow feature in selectedFeatures)
                {

                    int value = System.Convert.ToInt32(feature.get_Value(valueIndex));
                    IQueryFilter filter = new QueryFilterClass();
                    filter.WhereClause = "Value = " + value.ToString();
                    table.DeleteSearchedRows(filter);
                 }
                   
                IRasterCursor rasterCursor = (raster as IRaster2).CreateCursorEx(null);
                IPixelBlock3 pixelBlock = rasterCursor.PixelBlock as IPixelBlock3;

                while (rasterCursor.Next())
                {

                    if (pixelBlock.HasNoData(0))
                        pixelBlock.Clear(0);

                    pixelBlock = rasterCursor.PixelBlock as IPixelBlock3;
                }
               


Can someone help me?
Thanks,
Have a nice day.

Outcomes