Load Raster with Attributes to SDE

Created:2/4/2003
Description:

In current ArcGIS implementation, when a raster with attribute table (e.g. a grid) is imported to ArcSDE, the attributes get lost. This sample implements a couple of command for loading rasters to ArcSDE without losing attribute information, and retrieving the attributes in ArcMap.

How to use:
  1. Register the two dlls.
  2. In ArcCatalog, under Tools/Customize, click Add from file and locate LoadRaswithTable.dll, in Customize dialog, click Toolbars tab and check Context Menu, the Context Menu list will show up, click the down arrow and select Raster Dataset Context Menu->Export, now go back to the Customize dialog, click Command tab, click ArcSDE Rasters in the Categories list, Load raster with attributes command will show up in the Commands box, drag it onto the Export menu in the Context Menu list and drop it above Raster to Geodatabase. Close Context Menu list dialog and Customize dialog..
  3. Right click the raster you want to load to ArcSDE, select Export->Load raster with attributes, a dialog shows up, click on the icon to locate the output ArcSDE geodatabase and type in the output raster name, hit ok to close the dialog.
  4. The loading progress dialog shows up, the raster is loaded, if error occurs, a messagebox will pop up..
  5. In ArcMap, under Tools/Customize ->Commands, click Add from file and locate SDERasterTableSupport.dll, ArcSDE Rasters appears in the Categories list and Table Support in Commands list, drag Table Support command to any toolbar, close the Customize dialog..
  6. Add ArcSDE raster you loaded with attributes to ArcMap, select it, then click Table Support command, now its attribute table is hooked with the raster.
  7. You can see the attribute by Open Attribute table, and they also show up under the Symbology tab in Property page for renderer.

Application:
ArcGIS

Requires: ESRI Object Library

Difficulty: Intermediate


Visual Basic
File Description
frmInput.frm The form for selecting output SDE workspace and output raster name.
clLoadwithtab.cls The class module implementing ICommand for exporting a raster with attributes to SDE.
clEnableRasterTable.cls The class module for relating attribute table to raster dataset in SDE in ArcMap.
LoadRasWithTable.dll the dll to support loading rasters with attributes, it can be hooked to ArcCatalog context menu. It loads a raster and copy its attributes to another ArcSDE table with the name of <rasterdatasetname>_attributes.
SDERasterTableSupport.dll the dll to support attributes retrival, it can be added to any toolbar in ArcMap. It creates on-the-fly join of the raster and its attribute table with specified name of <rasterdatasetname>_attributes in ArcSDE. It loads a raster


Key CoClasses: RasterSDELoader, RasterBand
Key Interfaces: IRasterSDEConnection2, IRasterSDEStorage, IRasterBand
Key Members: IRasterBand::AttributeTable, IRasterSDEConnection2::Create