Exporting Mosaic raster catalog to DTED produces corrupt DTED data

Discussion created by lynedavid on Nov 15, 2010

I am trying to export a mosaic catalog to DTED as follows:

             IMosaicWorkspaceExtensionHelper MosaicWsHelper = new MosaicWorkspaceExtensionHelperClass();
             IMosaicWorkspaceExtension mosaicWsExtension = MosaicWsHelper.FindExtension(wksp);

  IMosaicDataset mosaic = mosaicWsExtension.OpenMosaicDataset(mdName);
                IFeatureClass fClass = (IFeatureClass)mosaic.Catalog;
                IRasterCatalogItem catalogItem = (IRasterCatalogItem)fClass.GetFeature(1);
                IRasterDataset rasterDataset = catalogItem.RasterDataset;

                    String rasterName = "elevationtest";

                    IRasterWorkspaceEx rasterWksp = wksp as IRasterWorkspaceEx;
                    IRasterDataset rasterDs = rasterDataset;

                    IWorkspaceFactory wkspFact = new RasterWorkspaceFactoryClass();
                    IWorkspace outputDir = wkspFact.OpenFromFile("esriimporttemp/elevation", 0);

                    ISaveAs2 saveAs = rasterDs as ISaveAs2;
                    IRasterStorageDef2 storageDef = (IRasterStorageDef2)new RasterStorageDefClass();
                    storageDef.CompressionType = esriRasterCompressionType.esriRasterCompressionUncompressed;
                    storageDef.Tiled = false;

                    bool canSave = saveAs.CanSaveAs("DTED");

                    if (canSave == true)
                        saveAs.SaveAsRasterDataset(rasterName + ".dt1", outputDir, "DTED", storageDef);

                        success = true;
                        success = false;
                catch (Exception ex)
                    report("Error saving elevation. " + ex.Message + "\n");

I find that the DTED data (Or TIFF if I replace DTED with TIFF to that matter) exports the imagery with the correct geographic projection BUT all the grid height posts are set to 768 metres.

What can be the cause of this?