Package org.geotools.coverage.processing

Coverage processing implementations. An explanation for this package is provided in the OpenGIS® javadoc. The remaining discussion on this page is specific to the Geotools implementation.

If the operation to apply is know at compile time, then the easiest way to use this package is to use the Operations convenience class. For example a grid coverage can be resampled to a different coordinate reference system using the following code:

Coverage reprojected = Operations.DEFAULT.resample(myCoverage, newCRS);

If the operation to apply is unknow at compile time (for example because it is selected at runtime by the user in some widget), or if the operation is not listed in the Operations convenience class, then the generic way is to invoke the doOperation method on the default processor instance. Available operations are listed in the operation package.

Supported operations

 


 

Convolve

Computes each output sample by multiplying elements of a kernel with the samples surrounding a particular source sample.

Name: "Convolve"
JAI operator: "Convolve"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A
"kernel" KernelJAI N/A N/A N/A

Back to summary

 


 

LaplaceType1Filter

Perform a laplacian filter operation on a grid coverage. This is a high pass filter which highlights the edges having positive and negative brightness slopes. This filter mulitples the co-efficients in the tabe below with the corresponding grid data value in the kernel window. The new grid value will be calculated as the sum of (grid value * co-efficient) for each kernel cell divised by 9.

0 -1 0
-1 4 -1
0 -1 0

Name: "LaplaceType1Filter"
JAI operator: "Convolve"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A

Back to summary

 


 

LaplaceType2Filter

Perform a laplacian filter operation on a grid coverage. This is a high pass filter which highlights the edges having positive and negative brightness slopes. This filter mulitples the co-efficients in the tabe below with the corresponding grid data value in the kernel window. The new grid value will be calculated as the sum of (grid value * co-efficient) for each kernel cell divised by 9.

-1 -1 -1
-1 8 -1
-1 -1 -1

Name: "LaplaceType1Filter"
JAI operator: "Convolve"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A

Back to summary

 


 

MaxFilter

Non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the max of the pixel values covered by the mask. There are several shapes possible for the mask, which are enumerated in the JAI documentation.

Name: "MaxFilter"
JAI operator: "MaxFilter"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A
"Xsize" Integer 3 1 N/A
"Ysize" Integer 3 1 N/A
"maskShape" MaxFilterShape MaxFilterDescriptor.MAX_MASK_SQUARE N/A N/A

Note: In current implementation, Xsize and Ysize must have the same value (i.e. rectangular shapes are not supported).

Back to summary

 


 

MedianFilter

Non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the median of the pixel values covered by the mask. This filter results in a smoothing of the image values. There are several shapes possible for the mask, which are enumerated in the JAI documentation.

Name: "MedianFilter"
JAI operator: "MedianFilter"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A
"Xsize" Integer 3 1 N/A
"Ysize" Integer 3 1 N/A
"maskShape" MedianFilterShape MedianFilterDescriptor.MEDIAN_MASK_SQUARE N/A N/A

Note: In current implementation, Xsize and Ysize must have the same value (i.e. rectangular shapes are not supported).

Back to summary

 


 

MinFilter

Non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the min of the pixel values covered by the mask. There are several shapes possible for the mask, which are enumerated in the JAI documentation.

Name: "MinFilter"
JAI operator: "MinFilter"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A
"Xsize" Integer 3 1 N/A
"Ysize" Integer 3 1 N/A
"maskShape" MinFilterShape MinFilterDescriptor.MIN_MASK_SQUARE N/A N/A

Note: In current implementation, Xsize and Ysize must have the same value (i.e. rectangular shapes are not supported).

Back to summary

 


 

Recolor

Changes the colors associated to arbitrary categories in arbitrary bands. The ColorMaps arguments must be an array of Maps with a minimal length of 1. The Map in array element 0 is used for band 0; the Map in array element 1 is used for band 1, etc. If there is more bands than array elements in ColorMaps, then the last Map is reused for all remaining bands.

For each Map in ColorMaps, the keys are category names as String and the values are colors as an array of type Color[]. All categories with a name matching a key in the Map will be recolored with the associated colors. All categories with no corresponding entries in the Map will be left unchanged. The null key is a special value meaning "any quantitative category". For example in order to repaint forest in green, river in blue and lets other categories unchanged, one can write:

    Map map = new HashMap();
    map.put("Forest", new Color[]{Color.GREEN});
    map.put("River",  new Color[]{Color.BLUE });
    Map[] colorMaps = new Map[] {
        map  // Use for all bands
    }
    

Name: "Recolor"
JAI operator: N/A
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A
"ColorMaps" Map[] A gray scale N/A N/A

Back to summary

 


 

Threshold

A gray scale threshold classifies the grid coverage values into a boolean value. The sample dimensions will be modified into a boolean value and the dimension type of the source sample dimension will be represented as 1 bit.

Name: "Threshold"
JAI operator: "Binarize"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage2D N/A N/A N/A
"threshold" double[] N/A N/A N/A

Back to summary