Hello,I am attempting to run some geoprocessing on a raster, then save the result to a GeoTIFF. I do this in ArcObjects by using ISaveAs on an IGeoDataset:
IWorkspace rws = null;
try {
rws = (IWorkspace)SetRasterWorkspace(path);
ISaveAs saveMe = (ISaveAs)raster;
saveMe.SaveAs( name, rws, "TIFF" );
}
finally {
COMHelper.SafeRelease(rws);
}
HOWEVER, this does not save the Spatial Reference or Georeference information in the GeoTIFF. This is extremely frustrating, because if I copy a raster from GRID to TIF, the georeference gets saved with the GeoTIFF. If I inspect my raster variable from the above, I can find a temporary location of the raster with the following command in my VS-2008 'Immediate Window':
((IRaster2)raster).RasterDataset
{System.__ComObject}
[System.__ComObject]: {System.__ComObject}
CompleteName: "C:\\Documents and Settings\\STANDARD\\ASPNET\\Local Settings\\Temp\\raster3"
CompressionType: "Default"
Format: "GRID"
SensorType: "Map Info"
And this is a GRID, with a Spatial Reference and the Georeference information intact. If this is the case, why does it get lost in the ISaveAs operation? Is there any way (in ArcObjects) to COPY this temporary raster to a GeoTIFF, instead of SaveAs, so I can preserve the Spatial Reference and Georeference information?Please advise,David