Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The new resample removes the right most pixel when transform is identity and interpolation is set to nearest.
Test case :
/** * Tests resample with an identity transform and a coverage extent change. * * @throws TransformException if some coordinates can not be transformed to the target grid geometry. */ @Test @Ignore public void testExtentIdentity() throws TransformException { final CoordinateReferenceSystem crs = CommonCRS.WGS84.normalizedGeographic(); final BufferedImage image = new BufferedImage(2, 2, BufferedImage.TYPE_BYTE_GRAY); final WritablePixelIterator ite = WritablePixelIterator.create(image); for (int x = 0; x < 2; x++) { for (int y = 0; y < 2; y++) { ite.moveTo(x, y); ite.setSample(0, 10); } } final AffineTransform2D gridToCrs = new AffineTransform2D(1, 0, 0, -1, 0, 0); final GridCoverageBuilder gcb = new GridCoverageBuilder(); gcb.setValues(image); gcb.setDomain(new GridGeometry(null, CELL_CENTER, gridToCrs, crs)); final GridCoverage coverage = gcb.build(); GridGeometry targetGrid = new GridGeometry(new GridExtent(4, 4), CELL_CENTER, gridToCrs, crs); final GridCoverage target = resample(coverage, targetGrid); Raster data = target.render(null).getData(); Assert.assertEquals(10, data.getSample(0, 0, 0)); Assert.assertEquals(10, data.getSample(1, 0, 0)); Assert.assertEquals( 0, data.getSample(2, 0, 0)); Assert.assertEquals( 0, data.getSample(3, 0, 0)); Assert.assertEquals(10, data.getSample(0, 1, 0)); Assert.assertEquals(10, data.getSample(1, 1, 0)); Assert.assertEquals( 0, data.getSample(2, 1, 0)); Assert.assertEquals( 0, data.getSample(3, 1, 0)); Assert.assertEquals( 0, data.getSample(0, 2, 0)); Assert.assertEquals( 0, data.getSample(1, 2, 0)); Assert.assertEquals( 0, data.getSample(2, 2, 0)); Assert.assertEquals( 0, data.getSample(3, 2, 0)); }
Attachments
Issue Links
- fixes
-
SIS-493 Raster reprojection
- Closed