The crop operation is responsible for selecting geographic subarea of the
source coverage. The CoverageCrop operation does not merely wrap the JAI Crop
operation but it goes beyond that as far as capabilities.
The key point is that the CoverageCrop operation aims to perform a spatial
crop, i.e. cropping the underlying raster by providing a spatial
Envelope (if the envelope is not 2D only the 2D part of it will be
used). This means that, depending on the grid-to-world transformation
existing for the raster we want to crop the crop area in the raster space
might not be a rectangle, hence JAI's crop may not suffice in order to shrink
the raster area we would obtain. For this purpose this operation make use of
either the JAI's Crop or Mosaic operations depending on the conditions in
which we are working.
Meaning of the ROI_OPTIMISATION_TOLERANCE parameter
In general if the grid-to-world transform is a simple scale and translate
using JAI's crop should suffice, but when the g2w transform contains
rotations or skew then we need something more elaborate since a rectangle in
model space may not map to a rectangle in raster space. We would still be
able to crop using JAI's crop on this polygon bounds but, depending on how
this rectangle is built, we would be highly inefficient. In order to overcome
this problems we use a combination of JAI's crop and mosaic since the mosaic
can be used to crop a raster using a general ROI instead of a simple
rectangle. There is a negative effect though. Crop would not create a new
raster but simply forwards requests back to the origina one (it basically
create a viewport on the source raster) while the mosaic operation creates a
new raster. We try to address this trade-off by providing the parameter
Crop.ROI_OPTIMISATION_TOLERANCE , which basically tells this
operation "Use the mosaic operation only if the area that we would load with
the Mosaic is strictly smaller then (ROI_OPTIMISATION_TOLERANCE)* A' where A'
is the area of the polygon resulting from converting the crop area from the
model space to the raster space.
Meaning of the CONSERVE_ENVELOPE parameter
When we crop a coverage using a spatial envelope we may incur in a few issues
with approximations when applying the grid-to-world transform and its
inverse. Goal of this parameter is to suggest this operation to conserve the
input crop envelope, if possible, instead of conserving the original
grid-to-world transform. This would help when doing something like building a
mosaic from a single coverage.
NOTE that in case we will use the Mosaic operation with a
ROI, such a ROI will be added as a synthetic property to the resulting
coverage. The key for this property will be GC_ROI and the type of the object
Polygon .
version: $Id: Crop.java 27037 2007-09-18 12:58:10Z simboss $ author: Simone Giannecchini, GeoSolutions since: 2.3 See Also: javax.media.jai.operator.ScaleDescriptor |