How can I load .SID files in ArcEngine? I think its possible, but I can't find any links.

With Kirk's help I got it here's the code:

  public void add_SID_file(string dir) 
            RasterWorkspaceFactory raster = new RasterWorkspaceFactoryClass();
            IRasterWorkspace rasterWorkspace = raster.OpenFromFile(dir, 0) as IRasterWorkspace;

            if (rasterWorkspace != null)
                IWorkspace w = rasterWorkspace as IWorkspace;
                IEnumDatasetName dsNames = w.get_DatasetNames(esriDatasetType.esriDTRasterDataset);
                IDatasetName datasetName = dsNames.Next();
                List<string> names = new List<string>(); 
                while (datasetName != null)
                    datasetName = dsNames.Next();
                if (names.Count > 0)
                    IRasterDataset pRasterDataset = rasterWorkspace.OpenRasterDataset(names[0]);
                    IRasterLayer pRasterLayer = new RasterLayerClass();
  • I've never seen any problems with this approach, but Esri advises to use Activator.CreateInstance instead of "new" for RasterWorkspaceFactory. See documentation here. Commented May 25, 2011 at 20:58

2 Answers 2


A less-verbose way of opening a Raster is to use GPUtilities.openRasterDatasetFromString. It's slower than writing the raw ArcObjects like you've done, but it handles a lot more of the edge cases internally.


Probably more than one way to do it, but I've used IRasterWorkspaceFactory.OpenFromFile and passed the folder (NOT the file) as an argument. Then use IRasterWorkspace.OpenRasterDataset. If you forget the naming convention, you can also loop through each raster dataset using the enumerator returned from IWorkspace.Datasets, and list the IDataset.Name. I forget if .sid is part of the name or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.