Mosaicking in a background thread leaves pyramids mangled

3544
0
02-24-2015 05:20 AM
GregMcQuat
New Contributor III

I have a portion of my application that creates temporary tiled raster datasets and then mosaics them back into a geodatabase raster dataset:

 

private void MosaicRasterIntoRasterDataset(IRaster raster, IRasterDataset rasterDataset)

        {

            IRasterDatasetEdit3 rdEdit = (IRasterDatasetEdit3)rasterDataset;

            rdEdit.Mosaic(raster, 0.01);

           

            ((IRasterDataset3)rasterDataset).PrecalculateStats(0);

            ((IRasterDataset3)rasterDataset).Refresh();

        }

 

I'm not sure if PrecalculateStats or Refresh are even necessary here.

 

I release the reference to rasterDataset and the geodatabase workspace in the calling block before closing the thread.

 

Here's the issue: when I load this raster dataset into ArcMap, there are portions of the pyramids missing at different pyramid levels and sometimes the raster data doesn't display at full resolution either or recognize that there has been a change in extent. I say sometimes because it is truly hit or miss. Attempting to build pyrmids doesn't appear to do anything (takes 0-1 second) but restarting the application and deleting pyramids and then rebuilding them usually resolves these issues.

 

Am I missing something in the mosaic process to trigger the approporiate pyramids to be reconstructed? Does my thread need to stay open after I've made this call in order for the appropriate actions to happen in the GDB? Is this a bug in ESRI software (I've seen similar posts that make me think it might be but aren't definitive on this).

 

Note that I'm developing at Basic so Mosaic Dataset isn't an option here.

Tags (1)
0 Kudos
0 Replies