zoukankan      html  css  js  c++  java
  • Accessing raster workspaces

    Accessing raster workspaces

    All geodatabase workspaces support the IRasterWorkspaceEx interface, while file workspaces support IRasterWorkspace. See the following code example:
     

    [C#]
    //Open file geodatabase workspace as RasterWorkspace.
    static IRasterWorkspaceEx OpenFGDB(string FGDBPath)
    {
        //FGDBPath string example: c:\data\raster.gdb.
        IWorkspaceFactory2 workspaceFactory = new FileGDBWorkspaceFactoryClass();
        return (IRasterWorkspaceEx)workspaceFactory.OpenFromFile(FGDBPath, 0);
    }
    
    //Open ArcSDE workspace as RasterWorkspace.
    static IRasterWorkspaceEx OpenSDE(string conString)
    {
        //conString example: SERVER=qian;INSTANCE=9200;VERSION=sde.DEFAULT;USER=raster;PASSWORD=raster.
        IWorkspaceFactory2 workspaceFactory = new SdeWorkspaceFactoryClass();
        return (IRasterWorkspaceEx)workspaceFactory.OpenFromString(conString, 0);
    }
    
    //Open accessed workspace as RasterWorkspace.
    static IRasterWorkspaceEx OpenAccess(string PGDBPath)
    {
        //FGDBPath string example: c:\data\rasters.mdb.
        IWorkspaceFactory2 workspaceFactory = new AccessWorkspaceFactoryClass();
        return (IRasterWorkspaceEx)workspaceFactory.OpenFromFile(PGDBPath, 0);
    }
    
    //Open file workspace as RasterWorkspace.
    static IRasterWorkspace OpenFileWorkspace(string wsPath)
    {
        //wsPath example: c:\data\rasters.
        IWorkspaceFactory workspaceFact = new RasterWorkspaceFactoryClass();
        return (IRasterWorkspace)workspaceFact.OpenFromFile(wsPath, 0);
    }

    [VB.NET]
    'Open file geodatabase workspace as RasterWorkspace.
    
    Public Function OpenFGDB(ByVal FGDBPath As String) As IRasterWorkspaceEx
        'FGDBPath string example: c:\data\raster.gdb.
        Dim workspaceFactory As IWorkspaceFactory2 = New FileGDBWorkspaceFactoryClass()
        Return CType(workspaceFactory.OpenFromFile(FGDBPath, 0), IRasterWorkspaceEx)
    End Function
    
    'Open ArcSDE workspace as RasterWorkspace
    
    Public Function OpenSDE(ByVal conString As String) As IRasterWorkspaceEx
        'conString example: SERVER=qian;INSTANCE=9200;VERSION=sde.DEFAULT;USER=raster;PASSWORD=raster.
        Dim workspaceFactory As IWorkspaceFactory2 = New SdeWorkspaceFactoryClass()
        Return CType(workspaceFactory.OpenFromString(conString, 0), IRasterWorkspaceEx)
    End Function
    
    'Open accessed workspace as RasterWorkspace.
    
    Public Function OpenAccess(ByVal PGDBPath As String) As IRasterWorkspaceEx
        'FGDBPath string example: c:\data\rasters.mdb.
        Dim workspaceFactory As IWorkspaceFactory2 = New AccessWorkspaceFactoryClass()
        Return CType(workspaceFactory.OpenFromFile(PGDBPath, 0), IRasterWorkspaceEx)
    End Function
    
    'Open file workspace as RasterWorkspace.
    
    Public Function OpenFileWorkspace(ByVal wsPath As String) As IRasterWorkspace
        'wsPath example: c:\data\rasters.
        Dim workspaceFact As IWorkspaceFactory = New RasterWorkspaceFactoryClass()
        Return CType(workspaceFact.OpenFromFile(wsPath, 0), IRasterWorkspace)
    End Function
  • 相关阅读:
    移动web开发之flex布局(弹性布局)
    移动web开发之流式布局
    移动端基础
    3D变形(CSS3) transform
    动画(CSS3) animation
    2D变形(CSS3) transform
    过渡(CSS3)
    CSS精灵技术(sprite)
    字体图标
    伸缩布局(CSS3)
  • 原文地址:https://www.cnblogs.com/gisoracle/p/1914303.html
Copyright © 2011-2022 走看看