[ 
https://issues.apache.org/jira/browse/SIS-548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Desruisseaux updated SIS-548:
------------------------------------
    Issue Type: Bug  (was: Improvement)

> Unexpected wraparound during intersection of grid geometries
> ------------------------------------------------------------
>
>                 Key: SIS-548
>                 URL: https://issues.apache.org/jira/browse/SIS-548
>             Project: Spatial Information Systems
>          Issue Type: Bug
>          Components: Coverage
>    Affects Versions: 1.1, 1.2
>            Reporter: Martin Desruisseaux
>            Assignee: Martin Desruisseaux
>            Priority: Major
>             Fix For: 1.3
>
>
> 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}}.
> {noformat}
> Column: [-179 … 181] (361 cellules)
> Row:    [   3 …   3]   (1 cellules)
> {noformat}
> Test cases:
> {code:java}
> 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);
> }
> {code}
> {code:java}
>     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);
>     }
> {code}
> This issue has been reported by Johann.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to