Poking around this morning, I found that the following avoided the error: int SplitRaster(IRasterDataset rds, IPolygon extent, ...
{
IRasterProps rasterProps = (IRasterProps)rds.CreateDefaultRaster();
IEnvelope dsExtent = rasterProps.Extent;
// The following leads to weird error
// if (!IsOverlap(extent, dsExtent))
// return 0;
// This avoids the error
IEnvelope testExtent = new EnvelopeClass();
testExtent.PutCoords(dsExtent.XMin, dsExtent.YMin, dsExtent.XMax, dsExtent.YMax);
if (!IsOverlap(extent, testExtent))
return 0;
Unfortunately, the result was incorrect. I then noticed that I'd forgotten to copy over the spatial reference. When I did that (i.e. set testExtent.SpatialReference = dsExtent.SpatialReference), the error came back.So it seems the error is arising during an on-the-fly coordinate conversion (my polygon is NAD27, my raster is NAD83).