Creating a raster catalog layer
Do the following steps to create a raster catalog layer from a geodatabase raster catalog, then add it to a map:
- Create a raster catalog layer.
- Add it to the map if the layer is valid.
See the following code example:
public static void AddRasterCatalogLayer(ESRI.ArcGIS.Carto.IActiveView activeView,
ESRI.ArcGIS.Geodatabase.IRasterCatalog rasterCatalog)
{
//Create a raster catalog layer.
ESRI.ArcGIS.Carto.IGdbRasterCatalogLayer rastercatalogLayer=new
GdbRasterCatalogLayerClass();
rastercatalogLayer.Setup((ITable)rasterCatalog);
//Add it to the map if the layer is valid.
if (!(rastercatalogLayer == null))
{
ESRI.ArcGIS.Carto.IMap map=activeView.FocusMap;
map.AddLayer((ILayer)rastercatalogLayer);
}
}
[VB.NET] Public Shared Sub AddRasterCatalogLayer(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal rasterCatalog As ESRI.ArcGIS.Geodatabase.IRasterCatalog)
'Create a raster catalog layer.
Dim rastercatalogLayer As ESRI.ArcGIS.Carto.IGdbRasterCatalogLayer=New GdbRasterCatalogLayerClass()
rastercatalogLayer.Setup(CType(rasterCatalog, ITable))
'Add it to the map if the layer is valid.
If Not (rastercatalogLayer=Nothing) Then
Dim map As ESRI.ArcGIS.Carto.IMap=activeView.FocusMap
map.AddLayer(CType(rastercatalogLayer, ILayer))
End If
End Sub
To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
- ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
- ESRI.ArcGIS.Display
- ESRI.ArcGIS.Geometry
- ESRI.ArcGIS.DataSourcesGDB
- ESRI.ArcGIS.Geodatabase
- ESRI.ArcGIS.DataSourcesRaster
- ESRI.ArcGIS.Carto
Development licensing | Deployment licensing |
---|---|
ArcGIS for Desktop Advanced | ArcGIS for Desktop Advanced |
ArcGIS for Desktop Standard | ArcGIS for Desktop Standard |
ArcGIS for Desktop Basic | ArcGIS for Desktop Basic |
Engine Developer Kit | Engine |