This document is archived and information here might be outdated.  Recommended version.


Create MARasterLayer Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Create MARasterLayer Snippet

Returns an MARasterLayer from a RasterWorkspacEx and an RPF catalog name string.

[C#]
///<summary>Returns an MARasterLayer from a RasterWorkspacEx and an RPF catalog name string.</summary>
/// 
///<param name="rasterWorkspaceEx">An IRasterWorkspaceEx interface</param>
///<param name="rasterCatalogName">A System.String of an existing RPF catalog. Example: "myRPFrasterCatalog".</param>
///  
///<returns>An IMARasterLayer interface</returns>
///  
///<remarks></remarks>
public ESRI.ArcGIS.DefenseSolutions.IMARasterLayer CreateMARasterLayer(ESRI.ArcGIS.Geodatabase.IRasterWorkspaceEx rasterWorkspaceEx, System.String rasterCatalogName)
{
  // Open the raster catalog
  ESRI.ArcGIS.Geodatabase.IRasterCatalog rasterCatalog=rasterWorkspaceEx.OpenRasterCatalog(rasterCatalogName);

  // Create the MARasterLayer
  ESRI.ArcGIS.DefenseSolutions.IMARasterLayer maRasterLayer=new ESRI.ArcGIS.DefenseSolutions.MARasterLayerClass();
  if (!(maRasterLayer.Setup((ESRI.ArcGIS.Geodatabase.ITable)rasterCatalog) == true)) // Explicit Cast
  {
    return null;
  }
  else
  {
    return maRasterLayer;
  }
}
[Visual Basic .NET]
'''<summary>Returns an MARasterLayer from a RasterWorkspacEx and an RPF catalog name string.</summary>
''' 
'''<param name="rasterWorkspaceEx">An IRasterWorkspaceEx interface</param>
'''<param name="rasterCatalogName">A System.String of an existing RPF catalog. Example: "myRPFrasterCatalog".</param>
'''  
'''<returns>An IMARasterLayer interface</returns>
'''  
'''<remarks></remarks>
Public Function CreateMARasterLayer(ByVal rasterWorkspaceEx As ESRI.ArcGIS.Geodatabase.IRasterWorkspaceEx, ByVal rasterCatalogName As System.String) As ESRI.ArcGIS.DefenseSolutions.IMARasterLayer

  'Open the raster catalog
  Dim rasterCatalog As ESRI.ArcGIS.Geodatabase.IRasterCatalog=rasterWorkspaceEx.OpenRasterCatalog(rasterCatalogName)

  'Create the MARasterLayer
  Dim maRasterLayer As ESRI.ArcGIS.DefenseSolutions.IMARasterLayer=New ESRI.ArcGIS.DefenseSolutions.MARasterLayerClass

  If Not maRasterLayer.Setup(CType(rasterCatalog, ESRI.ArcGIS.Geodatabase.ITable))=True Then
    Return Nothing
  Else
    Return maRasterLayer
  End If

End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.DefenseSolutions
  • ESRI.ArcGIS.Geodatabase
  • ESRI.ArcGIS.System