//IWorkspaceFactory OpenFromFile Example

    //e.g., nameOfFile = "E:\\data\\english\\access\\canada\\canada.mdb"
    public IWorkspace IWorkspaceFactory_OpenFromFile_Example_Access(string nameOfFile)
    {
        IWorkspaceFactory workspaceFactory= new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass();
        return workspaceFactory.OpenFromFile(nameOfFile, 0);
    }

 

    //e.g., nameOfFile = "E:\\data\\english\\FileGDB\\canada\\canada.gdb"
    public IWorkspace IWorkspaceFactory_OpenFromFile_Example_FileGDB(string nameOfFile)
    {
        IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass();
        return workspaceFactory.OpenFromFile(nameOfFile, 0);
    }

 

    //e.g., nameOfFile = "D:\\data\\redarrow.sde"
    public IWorkspace IWorkspaceFactory_OpenFromFile_Example_ArcSDE(string nameOfFile)
    {
        IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
        return workspaceFactory.OpenFromFile(nameOfFile, 0);
    }

 

    //The connection string for a shapefile should be the full path
    //to the Shapefile's folder (e.g., "C:\\temp")
    // Note: location cannot be relative path ".\\temp" it must be an explicit pathname
    public IWorkspace IWorkspaceFactory_OpenFromFile_Example_Shapefile(string nameOfFile)
    {
        IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
        return workspaceFactory.OpenFromFile(nameOfFile, 0);
    }

相关文章:

  • 2021-04-15
  • 2021-08-03
  • 2022-01-01
  • 2021-11-19
  • 2021-07-25
  • 2021-12-09
  • 2021-07-27
猜你喜欢
  • 2022-01-04
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-01-01
  • 2022-12-23
相关资源
相似解决方案