Removing a color representing NoData from an image service definition
It is recommended that you edit the shape of a footprint polygon to remove unwanted pixels from a raster dataset (especially when around the board of the raster dataset). This method of clipping is much more efficient than using transparency to exclude NoData pixels, especially in cases of overlapping raster datasets. To do this, you can use the Recompute Footprint By Radiometry feature. This feature has a set of parameters that let you define the minimum and maximum pixel values that should be considered NoData. Additionally, you can specify other parameters that define the approximate number of vertices required to represent the shape, which can be very effective while extracting the correct footprints, especially when the edges are irregular. One limitation of this feature is that the NoData values can only be defined as either black or white color.
It's easy to define a black or white value in a raster dataset, whether it's an RGB band combination or a single-band image, because the values will always be the same for each band. However, there are raster datasets that use specific colors, such as green, to symbolize a NoData value. In those cases, the pixel values for each band will vary.
In this workflow, you will apply a classification to the raster datasets at the service level to recompute the NoData values from a color into black or white and the remaining values into gray. Next, you will use the Recompute Footprint By Radiometry feature to extract and update the desired footprint. Then you will remove the classification process, leaving you with the correct footprints for your image service definition.
Create an image service definition
- Open ArcMap.
- Click the Image Service drop-down menu on the Image Service Definition Editor toolbar, point to Advanced, then click New Service Definition.
- Type the Service definition path and name in the text box, or click the browse button to navigate to the location and provide a name.
- Click the Spatial reference browse button and choose a spatial reference file for either a geographic or projected coordinate system.
- Click the Service type drop-down arrow and click Color (RGB).
-
Click OK to create the new service.
The new service is added to the table of contents as a customized group layer.
- Click the Image Service drop-down menu on the Image Service Definition Editor toolbar, point to Advanced, then click Add Raster Dataset.
- Add your raster dataset to the image service definition.
-
Click the Image Service drop-down menu on the Image Service Definition Editor toolbar, point to Advanced, then click Build.
Build the image service definition with the default options.
- Click OK.
![Remarque Remarque](rsrc/note.png)
It is recommended that you generate service overviews after recomputing the footprints.
You should be able to preview after building the image service definition, but in many cases, the NoData values at the edges of the raster datasets hide the data. If the NoData values are black or white, the standard process to recompute footprint by radiometry can be used to redefine the footprints. However, for NoData values with different colors, you will have to use the Classify Pixel process before recomputing the footprints.
Add the Classify Pixel service process
Applying the Classify Pixel process converts the specific colors, such as green, to black.
-
Click the Image Service Properties button
on the Image Service Definition Editor toolbar.
- Click the Service Process node.
-
Add the Classify Pixel process to the Processes Selected list and click the Edit button
to change the required process parameters.
- Click the Include method drop-down arrow and click All.
- Click the Exclude method drop-down arrow and click And.
-
Type the appropriate pixel value to represent the color in the Exclude range for band text boxes.
For example, green is typically represented by the RGB values 0,255,0. Therefore, you could type 0-0 in the Exclude range for band 1, 254-255 in the Exclude range for band 2, and 0-0 in the Exclude range for band 3 fields.
- Build the image service definition with the Compute Output Properties option checked.
![Astuce Astuce](rsrc/tip.png)
You could also change the output definition from three bands to one band, because the classification process will change the output to a panchromatic image service definition.
Recompute the footprints by radiometry
- Right-click the Footprint layer in the table of contents, point to Recompute Footprint, then click By Radiometry.
- Click the Image type drop-down arrow and click an option.
- Click the Image compression drop-down arrow and click either Noncompressed imagery or Lossy compressed imagery.
- Optionally, click the Advanced tab and make changes to the parameters.
-
Click OK.
The footprints are redefined to the exact extents of the image and unwanted colors are removed.
After running this process, you should be able to see the footprints correctly following the extents of the NoData values, and the areas of NoData should not be visible. If they are still visible, you may have to edit the parameters in the Classify Pixel process.
![Astuce Astuce](rsrc/tip.png)
You could also handle images with alpha channel bands and display alpha channel bands as NoData using the Recompute Footprint By Radiometry option.
Remove the Classify Pixel process
-
Click the Image Service Properties button
on the Image Service Definition Editor toolbar.
- Click the Service Process node.
- Remove the Classify Pixel process from the Processes Selected list.
Build and compile the image service definition
As a final step, it is necessary to change the image service definition back to the original three-band service.
- Click the Image Service drop-down menu on the Image Service Definition Editor toolbar, point to Advanced, then click Build.
- Check Compute output pixel properties and Load preview.
- You may need to build service overviews.
- Compile the image service definition.