Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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();
share|improve this question
I've never seen any problems with this approach, but Esri advises to use Activator.CreateInstance instead of "new" for RasterWorkspaceFactory. See documentation here. – Kirk Kuykendall May 25 '11 at 20:58
up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
+1 yes, probably a lot less verbose! – Kirk Kuykendall May 26 '11 at 2:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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