Coming back to post a possible solution:
I ended up manually calculating the transformed geo-envelope
(JTS#transform()), then attaching it to the transformed coverage via
GridCoverageFactory:
------------------------------------------------------------
[...]
Envelope originalEnv = imgCoverage.getEnvelope();
Envelope
targetBbox =
JTS.transform(originalEnv, new AffineTransform2D(affTr));
[...] // TRANSFORM (see below), then finally:
transformedCoverage
=
GRIDCOV_FACTORY.create(
transformedCoverage
.getName().toString(),
transformedCoverage
.getRenderedImage(),
targetBbox
);
------------------------------------------------------------
hth,
-Piero
On 22 November 2016 at 15:23, Piero Campalani <[email protected]> wrote:
> Hi there,
>
> I am applying an affine transform to a grid-coverage via coverage
> processor + org.geotools.coverage.processing.operation.Affine:
>
> ------------------------------------------------------------
> ----------------
> File img = new File("/path/to/image");
> GridCoverage2D imgCoverage = GridFormatFinder.findFormat(
> img).getReader(img).read(null);
> Interpolation INTERP = Interpolation.getInstance(
> Interpolation.INTERP_NEAREST);
> AffineTransform affTr = new AffineTransform();
> affTr.translate(X, Y);
> [...]
> Operation affOp = new Affine();
> ParameterValueGroup param = affOp.getParameters();
> param.parameter("Source").setValue(imgCoverage);
> param.parameter("transform").setValue(affTr);
> param.parameter("Interpolation").setValue(INTERP);
> GridCoverage2D transformedCoverage = (GridCoverage2D)
> COV_PROCESSOR.doOperation(param);
> ------------------------------------------------------------
> ----------------
>
> I can see that, although the affine transform is attached to the grid
> geometry of the coverage, the geo-envelope does not change with respect to
> the source grid-coverage, hence e.g. translations do not have any effect on
> the map. Rotations are visible, but again dimensions get smaller to fit
> into the source envelope.
>
> Is there a way let the geo-bounds of the processed coverage correctly
> follow the underlying image transformations?
>
> Thanks for any comment,
> -Pier
> o
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users