统计栅格数据中某个字段的个数、和等

            IRasterLayer rasterLayer = axMapControl1.get_Layer(0) as IRasterLayer;
            IRaster pRaster = rasterLayer.Raster;
            IRasterBandCollection collection= pRaster as IRasterBandCollection;
            IRasterBand band=collection.Item(0);
            ITable pTable= band.AttributeTable;
            IDataStatistics pDataStatistics = new DataStatistics();
            IQueryFilter filter=new QueryFilter();
            filter.WhereClause="\"Value\"<350";
            ICursor pCursor = pTable.Search(filter, false);
            pDataStatistics.Cursor = pCursor;
            pDataStatistics.Field = "Count";
            IStatisticsResults pStaResult = pDataStatistics.Statistics;
            double count = pStaResult.Sum;

posted @ 2015-01-25 21:43  刘朝样  阅读(244)  评论(0)    收藏  举报