duwutudou

problem when casting IGeodataset to IRaster

Discussion created by duwutudou on Apr 13, 2013
hi,   
    i want to select specified areas from the dem data, which is below a height value. firstly, i use the IMathOp interface to convert the raster to integer. then i use IRasterDescriptor and filter to query the specified area, however, a cast problem comes up:
java.lang.ClassCastException: com.esri.arcgis.geodatabase.IGeoDatasetProxy cannot be cast to com.esri.arcgis.geodatabase.IRaster

    i'm using the arcobjects sdk 10.0 for java, the core codes are as follows:
RasterDataset rasterDataset = (RasterDataset) rasterWorkspace.openRasterDataset(demFileWithoutSuffix);
IMathOp mathOp = new RasterMathOps();
IGeoDataset geoDataset = mathOp.esri_int(rasterDataset);
...
IQueryFilter queryFilter = new QueryFilter();
queryFilter.setWhereClause("value<" + pHigh); //pHigh is the height value to query the specified areas
IRasterDescriptor descriptor = new RasterDescriptor();
descriptor.create((IRaster) geoDataset, queryFilter,"value");
...

    Is there anyone can help me , thanks very much!

Outcomes