InRamImageData to raster failed

Jan 24, 2011 at 12:23 PM

 I am having a weird problem where an inRamImageData (IDataSet) could not be converted to  IRaster

This happend to RasterLayer.cs line 58

 IRaster r = DataManager.DefaultDataManager.OpenRaster(fileName);

any ideas why ?

Developer
Jan 24, 2011 at 3:15 PM

The inRamImageData is an Image, not a Raster.  In our lingo, a raster is a grid where the values can be byte, int, short, float or doubles, but don't generally correlate to red green and blue values.  Images on the other hand almost always represent their values as ARGB, RGB, Greyscale or palette representations.  We might be using an inRamImageData in the open raster method to represent the actual symbolized raster.  That is, in order for you to see something on your map, there is usually an image that goes along with the raster object.  So if there is a situation where OpenRaster is trying to cast an inRamImageData into an IRaster, then that is a significant logic error since there is no relationship there.  The inRamImageData could be cast into an ImageData, or DataSet maybe, but not an IRaster.  So if you personally are writing code to do the cast, then try a different approach.  If the OpenRaster code is doing this, then this is probably a transcription error where the same open file code was being copied between images and rasters and something got copied that shouldn't have and we should post this as an issue so it can be repaired.

Ted