Description
The following test case produces an intersection like below. This intersection covers 360° of longitude, while a much smaller intersection was expected. This is caused by an unexpected "wraparound" applied by CoordinateOperationFinder.
Column: [-179 … 181] (361 cellules) Row: [ 3 … 3] (1 cellules)
Test cases:
public static void main(String[] args) { CoordinateReferenceSystem crs = CommonCRS.WGS84.normalizedGeographic(); AffineTransform2D gridToCrs = new AffineTransform2D(1, 0, 0, -1, -103.5, 52.5); GridGeometry tilingScheme = new GridGeometry(new GridExtent(1, 1), PixelInCell.CELL_CENTER, gridToCrs, crs); AffineTransform2D gridToCrs2 = new AffineTransform2D( 2.7770063871146905E-4, 0, 0, -2.7770063871146905E-4, 77.00013885031936, 49.99986114968065); GridGeometry tileGrid = new GridGeometry(new GridExtent(3601, 3601), PixelInCell.CELL_CENTER, gridToCrs2, crs); GridExtent intersection = tilingScheme.derive() .clipping(GridClippingMode.NONE) .rounding(GridRoundingMode.ENCLOSING) .subgrid(tileGrid).getIntersection(); System.out.println(intersection); }
public static void main(String[] args) { CoordinateReferenceSystem crs = CommonCRS.WGS84.normalizedGeographic(); AffineTransform2D gridToCrs = new AffineTransform2D( 0.0020833333333333333, 0, 0, -0.0020833333333333333, -179.99895833333332, -45.001041666666666); GridGeometry tilingScheme = new GridGeometry( new GridExtent(null, new long[]{0, -64800}, new long[]{172799,21599}, true), PixelInCell.CELL_CENTER, gridToCrs, crs); AffineTransform2D gridToCrs2 = new AffineTransform2D( 0.001373291015625, 0, 0, -0.001373291015625, -179.99931335449220, 89.99931335449219); GridGeometry tileGrid = new GridGeometry(new GridExtent(256, 256), PixelInCell.CELL_CENTER, gridToCrs2, crs); GridGeometry intersection = tilingScheme.derive() .subgrid(tileGrid).build(); System.out.println(tilingScheme); System.out.println(tileGrid); System.out.println(intersection); }
This issue has been reported by Johann.