ArcEngine 10 migration and raster algebra problem

540
0
06-22-2011 12:43 PM
KarlSiemsen
New Contributor
I posted a similar question last week which got no responses, but I've done a little more digging and found some new and interesting details so, here goes again:

I'm trying to migrate a standalone desktop application built on ArcEngine 9.3 to ArcEngine 10.

I've gone through all the migration steps to get to a working program. The core algorithm includes a number of map algebra operations run using the RasterModel class and saving outputs as GRID files in a personal geodatabase. Two different sets of these run and work fine. At first I thought the third, which uses the ouputs from the first set as inputs, created a raster with max and min values of 3.4e10+38 and -3.4e10+38, which is, obviously, not the correct output from the map algebra. It displays as a gray field. I have since discovered that if I then go back and add another of these output rasters, it will now display correctly, with values in acceptable ranges. Only the first raster I add to my map document displays incorrectly. The same raster added after another raster will display correctly.

Nevertheless, my code throws an error when attempting to work with these rasters:

Value does not fall within the expected range at ESRI.ArcGIS.DataSourcesRaster.IRasterProps.set_NoDataValue.

The line throwing the error is:

pRasPropNew.NoDataValue = pRasProp.NoDataValue;

where pRasPropNew is an IRasterProps interface on a newly created RasterDataset and pRasProp is an IRasterProps interface on the Raster described above that sometimes displays correctly and sometimes not.

The program works fine and produces correct outputs when run with ArcEnine 9.2 or 9.3, none of the functional code for the map algebra has changed with the migration, so I'm inclined to blame this on some previously undiscovered bug or incompatibility between 9.3 and 10 having to do either with the RasterModel or with saving and opening rasters from personal geodatabases. I'm open to any possibility though.

This is the map algebra statement:

[out1] = [input0] * 10 + [input1] * -1 + [input2] * 5 + [input3] * 10 + 0.0
0 Kudos
0 Replies