How To: Display a subset of rasters from ArcSDE raster catalog in ArcIMS
In ArcIMS, it is possible to control the visibility of individual raster layers from an ArcSDE raster catalog.
When working with vector data, database views are commonly used to restrict user ability to see sensitive attribute information. Similar functionality can be mimicked for raster layers in an ArcSDE raster catalog in ArcIMS by using the SPATIALQUERY element.
The SPATIALQUERY element contains a WHERE attribute. The WHERE attribute is used to define the WHERE clause in a SQL expression. In this example, the WHERE attribute dictates raster tiles from the raster catalog that are present or not in the output image produced by ArcIMS.
Determine the names of the raster layers in the raster catalog to be used in the WHERE clause of the SPATIALQUERY element. These rasters are rendered in the output image by the ArcIMS Spatial Server.
To determine the names of the raster layers:
Make a connection to the ArcSDE database in ArcCatalog.
Select the ArcSDE raster catalog.
On the Contents tab, select and note the names of the rasters to be made available through ArcIMS. For example:
If the ArcSDE raster catalogs were created with ArcSDE 8.3 or earlier, it is not possible to preview the rasters and note the raster names when clicking on the Contents tab. Click the Preview tab and select 'Preview: table' at the bottom. Note the names of the individual raster layers listed in the IMAGE column.
Add the ArcSDE raster layer to the map configuration file (.axl).
Use the SPATIALQUERY and its WHERE attribute to create an expression that limits raster availability in the raster catalog.
Include the names of the individual raster layers noted in step 1C in the where clause for the SPATIALQUERY element. For example:
<LAYER type="image" name="ARCIMS.ARCIMS.REDLANDS" visible="true" id="0">
<DATASET name="ARCIMS.ARCIMS.REDLANDS.RASTER" type="image" workspace="sde_ws-0" />
<b><SPATIALQUERY where="NAME = 'img001.jpg' or NAME = 'img002.jpg' or NAME = 'img003.jpg'" /></b>
If a raster catalog contains hundreds or thousands of rasters, it may be tedious to list each raster layer in the WHERE clause in the SPATIALQUERY element. To work around this issue, an attribute can be added to the business table for the raster catalog to simplify the operation.
Using ArcCatalog, create a new attribute column in the business table for the raster catalog. An example is a field called 'INCLUDE' using the text field type. Example attributes are 'YES' or 'NO'.
Open ArcMap and add the ArcSDE raster catalog to the data frame.
Right-click the ArcSDE raster catalog and select 'Open Attribute Table'.
Select all of the rows from the raster catalog to be included in the map produced by ArcIMS. Right-click the field just created (INCLUDE) and select 'Calculate Values'.
A message appears indicating the following: "You are about to do a calculate outside of an edit session ...". Click Yes to proceed.
When the Field Calculator opens, type "YES" (quotes included) and click OK.
To exclude rasters from the raster catalog displayed in ArcIMS, click the Options button then Switch Selection. Right-click the field just created (INCLUDE), and select 'Calculate Values'. When the Field Calculator opens, type "NO" (quotes included) and click OK.
The following is an example business table for the ArcSDE raster catalog illustrating the new attribute.
Use the SPATIALQUERY element and its WHERE attribute to create an expression to query the new attribute created in step 4. Again, this limits raster availability from the raster catalog. Add the new 'INCLUDE' attribute and the attribute value 'YES' from step 4 in the where clause for the SPATIALQUERY element. For example: