Class ImageMosaicFormat

Object
AbstractGridFormat
ImageMosaicFormat
All Implemented Interfaces:
Format

public final class ImageMosaicFormat extends AbstractGridFormat implements Format
AbstractGridFormat subclass for controlling ImageMosaicReader creation. As the name says, it handles mosaic of georeferenced images, which means
  1. tiff+tfw+prj
  2. jpeg+tfw+prj
  3. png+tfw+prj
  4. geotiff
This does not mean that you throw there a couple of images and it will do the trick no matter how these images are. Requirements are:
  • (almost) equal spatial resolution
  • same number of bands
  • same data type
  • same projection
The first requirement can be relaxed a little but if they have the same spatial resolution the performances are much better. There are parameters that you can use to control the behaviour of the mosaic in terms of thresholding and transparency. They are as follows:
  • --DefaultParameterDescriptor FINAL_ALPHA = new DefaultParameterDescriptor( "FinalAlpha", Boolean.class, null, Boolean.FALSE)-- It asks the plugin to add transparency on the final created mosaic. IT simply performs a threshonding looking for areas where there is no data, i.e., intensity is really low and transform them into transparent areas. It is obvious that depending on the nature of the input images it might interfere with the original values.
  • ---ALPHA_THRESHOLD = new DefaultParameterDescriptor( "AlphaThreshold", Double.class, null, Double.valueOf(1));--- Controls the transparency addition by specifying the treshold to use.
  • INPUT_IMAGE_THRESHOLD = new DefaultParameterDescriptor( "InputImageROI", Boolean.class, null, Boolean.FALSE)--- INPUT_IMAGE_THRESHOLD_VALUE = new DefaultParameterDescriptor( "InputImageROIThreshold", Integer.class, null, Integer.valueOf(1));--- These two can be used to control the application of ROIs on the input images based on tresholding values. Basically using the threshold you can ask the mosaic plugin to load or not certain pixels of the original images.
Since:
2.3
Author:
Simone Giannecchini (simboss), GeoSolutions, Stefan Alfons Krueger (alfonx), Wikisquare.de : Support for jar:file:foo.jar/bar.properties URLs
  • Field Details

    • FILTER

      public static final ParameterDescriptor<Filter> FILTER
      Filter tiles based on attributes from the input coverage
    • FADING

      public static final ParameterDescriptor<Boolean> FADING
      Control the type of the final mosaic.
    • OUTPUT_TRANSPARENT_COLOR

      public static final ParameterDescriptor<Color> OUTPUT_TRANSPARENT_COLOR
      Control the transparency of the output coverage.
    • MAX_ALLOWED_TILES

      public static final ParameterDescriptor<Integer> MAX_ALLOWED_TILES
      Control the thresholding on the input coverage
    • DEFAULT_ARTIFACTS_FILTER_THRESHOLD

      public static final ParameterDescriptor<Integer> DEFAULT_ARTIFACTS_FILTER_THRESHOLD
      Control the default artifact filter luminance thresholding on the input coverages
    • ARTIFACTS_FILTER_PTILE_THRESHOLD

      public static final ParameterDescriptor<Double> ARTIFACTS_FILTER_PTILE_THRESHOLD
      Control the artifact filter ptile thresholding
    • VIRTUAL_NATIVE_RESOLUTION

      public static final ParameterDescriptor<double[]> VIRTUAL_NATIVE_RESOLUTION
      Defines a virtual native resolution. It virtually represents the native resolution to be used after reading a dataset before doing any other operation. It could be useful to limit somehow the data quality offered to the final user. As an instance if we have data at resolutions 0.5m, 1m, 2m, 4m, 8m and the virtual native resolution is 4m, and the request is looking for data at 2m resolution we should downsample the best nearest level to 4m and then get back at 2m. This will result in potentially pixellated output. When specified, values should be always positive.
    • ALLOW_MULTITHREADING

      public static final ParameterDescriptor<Boolean> ALLOW_MULTITHREADING
      Control the threading behavior for this plugin.
    • BACKGROUND_VALUES

      public static final ParameterDescriptor<double[]> BACKGROUND_VALUES
      Control the background values for the output coverage
    • INTERPOLATION

      public static final ParameterDescriptor<Interpolation> INTERPOLATION
      Control the interpolation to be used in mosaicking
    • ACCURATE_RESOLUTION

      public static final ParameterDescriptor<Boolean> ACCURATE_RESOLUTION
      Control the requested resolution calculation.
    • OUTPUT_TO_ALTERNATIVE_CRS

      public static final ParameterDescriptor<Boolean> OUTPUT_TO_ALTERNATIVE_CRS
      When this read parameter is set to true, the reader will produce output in the requested CRS, assuming it matches one of the native CRSs, as reported by the #GridCoverage2DReader@MULTICRS_EPSGCODES metadata entry, and that the requested grid geometry is expressed in said CRS. When set to false (default), then only the native CRS declared by #GridCoverage2DReader@getCoordinateReferenceSystem will be produced in output
    • SORT_BY

      public static final ParameterDescriptor<String> SORT_BY
      Optional Sorting for the granules of the mosaic.

      It does work only with DBMS as indexes

    • MERGE_BEHAVIOR

      public static final ParameterDescriptor<String> MERGE_BEHAVIOR
      Merging behavior for the various granules of the mosaic we are going to produce.

      This parameter controls whether we want to merge in a single mosaic or stack all the bands into the final mosaic.

    • EXCESS_GRANULE_REMOVAL

      public static final ParameterDescriptor<ExcessGranulePolicy> EXCESS_GRANULE_REMOVAL
      Controls the removal of excess granules

      This parameter controls whether the mosaic will attempt to remove excess granules, that is, granules not contributing pixels to the output, before performing the mosaicking. This is useful only if granules are overlapping, do not enable otherwise.

    • GEOMETRY_MASK

      public static final ParameterDescriptor<Geometry> GEOMETRY_MASK
      mask (as a polygon in native coordinates) to be applied to the produced mosaic. At the moment, it will be ignored in case of Heterogeneous CRS.
    • MASKING_BUFFER_PIXELS

      public static final ParameterDescriptor<Double> MASKING_BUFFER_PIXELS
      Control the Masking buffering (in raster size)
    • SET_ROI_PROPERTY

      public static final ParameterDescriptor<Boolean> SET_ROI_PROPERTY
      Control whether to set the ROI property in the output mosaic (as an instance, even when background values are set which usually results into setting a null ROI after the mosaic)
  • Constructor Details

    • ImageMosaicFormat

      public ImageMosaicFormat()
      Creates an instance and sets the metadata.
  • Method Details

    • getReader

      public ImageMosaicReader getReader(Object source)
      Description copied from class: AbstractGridFormat
      Gets a GridCoverageReader for this format able to create coverages out of the source object.

      In case this Format cannot reader the provided source object null is returned.

      Specified by:
      getReader in class AbstractGridFormat
      Parameters:
      source - The source object to parse.
      Returns:
      A reader for this Format or null.
      See Also:
      • org.geotools.data.coverage.grid.AbstractGridFormat#getReader(Object)
    • getWriter

      public GridCoverageWriter getWriter(Object destination)
      Description copied from class: AbstractGridFormat
      Retrieves a GridCoverageWriter suitable for writing to the provided destination with this format.

      In case no writers are available null is returned.

      Specified by:
      getWriter in class AbstractGridFormat
      Parameters:
      destination - The destinatin where to write.
      Returns:
      A GridCoverageWriter suitable for writing to the provided destination with this format.
    • accepts

      public boolean accepts(Object source, Hints hints)
      Description copied from class: AbstractGridFormat
      Tells me if this Format can read the provided input.
      Specified by:
      accepts in class AbstractGridFormat
      Parameters:
      source - The input object to test for suitability.
      hints - Hints to control the accepts internal machinery.
      Returns:
      True if this format can read this object, False otherwise.
    • accepts

      public boolean accepts(Object source)
      Description copied from class: AbstractGridFormat
      Tells me if this Format can read the provided input.
      Overrides:
      accepts in class AbstractGridFormat
      Parameters:
      source - The input object to test for suitability.
      Returns:
      True if this format can read this object, False otherwise.
      See Also:
      • org.geotools.data.coverage.grid.AbstractGridFormat#accepts(Object input)
    • getReader

      public ImageMosaicReader getReader(Object source, Hints hints)
      Description copied from class: AbstractGridFormat
      Gets a GridCoverageReader for this format able to create coverages out of the source object using the provided hints.

      In case this Format cannot reader the provided source object null is returned.

      Specified by:
      getReader in class AbstractGridFormat
      Parameters:
      source - The source object to parse. *
      hints - The Hints to use when trying to instantiate this reader.
      Returns:
      A reader for this Format or null.
      See Also:
    • getDefaultImageIOWriteParameters

      public GeoToolsWriteParams getDefaultImageIOWriteParameters()
      Throw an exception since this plugin is readonly.
      Specified by:
      getDefaultImageIOWriteParameters in class AbstractGridFormat
      Returns:
      nothing.
    • getWriter

      public GridCoverageWriter getWriter(Object destination, Hints hints)
      Description copied from class: AbstractGridFormat
      Call the accepts() method before asking for a writer to determine if the current object is supported.
      Specified by:
      getWriter in class AbstractGridFormat
      Parameters:
      destination - the destination object to write a WorldImage to
      hints - Hints to control the internal machinery.
      Returns:
      a new WorldImageWriter for the destination