Accessing raster workspaces

Source: Internet
Author: User
Document directory
  • 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 RasterWorkspacePublic 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.