persisting invalid extent error

473
3
06-08-2011 11:26 AM
KeithOlson
New Contributor III
I have some VB.NET code that includes clipping a raster to the extent of the map frame using the ITransformationOp.Clip method and I'm in the process of putting it through the ringer to make sure I have as many potential errors handled as possible.  There is one scenario, that I'm having trouble with: 

When the input raster is completely outside map frame extent, Arc throws an exception (ERROR 010092: Invalid output extent) and rightly so.  So far, so good...  However, if I then pan the map frame to include parts or all of the same raster and try to run the tool again, it throws the same error, even though the clip extent is now valid. 

I can select a different raster and it works fine.  But if I use the raster that was involved in the invalid extent error again, the error persists no matter where I pan/zoom the map to.  The only way to get that raster to work again, is to remove the layer from the map and then add it back in again.  Then the error does not come back as long as the clip extent is valid. 

Why would this be and how do I work around this?
0 Kudos
3 Replies
DuncanHornby
MVP Notable Contributor
Keith,

Without seeing the code it's a bit hard to answer. Is the envelope you are doing the clip with getting refreshed? Do you set any spatial analyst properties using the IRasterAnalysisEnvironment interface, if so are they getting refreshed?

I know you are developing in VB .Net but in a VB6 project of mine if a COM error occurred which I had not trapped for it would always blitz the whole tool bar and one would need to close and restart ArcMap. I was wondering if you could test for the scenario and stop it ever causing the error?

Duncan
0 Kudos
KeithOlson
New Contributor III
I'll try refreshing the envelope before clipping, that's a good idea.  

I'm not using any raster analysis environmental settings.  Are those properties necessary, since the clip function requires an extent?
0 Kudos
JulianoKersting
New Contributor III
I am stuck at the same point, it used to work fine on 9.3 now at 10 it returns this error after running 3 sucessful clips using ITransformationOp.
Checked enviro settings, refreshed envelop and cant figure this out.

Any help?

---------------------------------
                            //// Calls the reset method just to make sure 🙂
                            rasterAnalysisEnvironment.Reset();
                            // Set output extent
                            object_Envelope = (System.Object)pEnvelope;
                            rasterAnalysisEnvironment.SetExtent(ESRI.ArcGIS.GeoAnalyst.esriRasterEnvSettingEnum.esriRasterEnvValue, ref object_Envelope, ref object_Missing);

//here is where the error 010092 happens after 3rd time using different envelop extent.
                            pRasDS = (IRasterDataset)pTransformationOp.Clip((IGeoDataset)pRasterFull, pEnvelope);

---------------------------------------------------------
0 Kudos