Details
Description
When using the Resample operator (e.g. to crop and transform a coverage to a new CRS), the resulting Coverage sometimes has a GridGeometry which differs from that set in the operator parameters (+1 pixel in width and/or height).
This probably relates to the JAI problem flagged in the inline comment in Resampler2D.java at line 469:
"The JAI operation sometime returns an image with a bounding box different than what we
expected. This is true especially for the "Affine" operation: the JAI documentation said
explicitly that xmin, ymin, width and height image layout hints are ignored for this one.
As a safety, we check the bounding box in any case. If it doesn't matches, then we will
reconstruct the target grid geometry."
This unexpected grid geometry is checked for and the actual resulting grid geometry (which may be different to the requested grid geometry) is returned from the Resampler2D. This however may lead to downstream errors, e.g. where two coverages will later be overlaid and despite being resampled to what should be the same grid geometry, actually have differing grid geometry.
The ideal fix would be to sort out the feature in JAI that causes this.
Failing this, a workaround at the GeoTools level would be good so that the result is as expected, even if this could result in performance loss.
At the very least, the risk of this occuring should be flagged in the class documentation so that any client code programmer knows to check for potential effects and try a workaround or fail gracefully: currently the only place this possible problem is documented is in the comment copied above inline in the code.
This may well be what is causing GEOS-1215 (http://jira.codehaus.org/browse/GEOS-1215) [unconfirmed, but my personal suspicion]
Issue Links
- is depended upon by
-
GEOS-1215
Returned coverage dimensions do not always match those requested
-