Thank you
Flipping the coordinates doesn't solve the problem

Here is the updated code:

public void part1_Australia() throws FactoryException, Exception {

        CoordinateReferenceSystem eps4202 = CRS.forCode("EPSG:4202");
        CoordinateReferenceSystem eps4283 = CRS.forCode("EPSG:4283");

        double inputLat = -12;
        double inputLong = -115;
        double resultLat = -11.9986441666667;   // From GIGS Test5207
        double resultLong =-115.001261388889;   // from GIGS Test5207

        CoordinateOperation operation =
TransformUtil.getCoordinateTransformForPoint(eps4202, eps4283, inputLong,
inputLat);
        System.out.println(operation.toString());

        DirectPosition position = new DirectPosition2D(inputLong, inputLat);
        double[] coordinate =
operation.getMathTransform().transform(position, position).getCoordinate();
        Assert.assertEquals(resultLong, coordinate[0], 0.001);
        Assert.assertEquals(resultLat, coordinate[1], 0.001);

        // The other way around
        operation = TransformUtil.getCoordinateTransformForPoint(eps4283,
eps4202, inputLong, inputLat);
        position = new DirectPosition2D(resultLong, resultLat);
        coordinate = operation.getMathTransform().transform(position,
position).getCoordinate();
        Assert.assertEquals(inputLong, coordinate[0], 0.001);
        Assert.assertEquals(inputLat, coordinate[1], 0.001);
    }

and


public class TransformUtil {

    // Area of use will be calculated from single point
    public static CoordinateOperation
getCoordinateTransformForPoint(CoordinateReferenceSystem fromCRS,
CoordinateReferenceSystem toCRS, double lng, double lat) throws
FactoryException {
        DefaultGeographicBoundingBox bb = new
DefaultGeographicBoundingBox(lng, lat, lng, lat);

        return CRS.findOperation(fromCRS, toCRS, bb);
    }

}

On Tue, Dec 3, 2019 at 11:53 AM Martin Desruisseaux <
[email protected]> wrote:

> Hello Thierry
>
> I did not looked fully at the test yet, but a first look at the code and
> WKT make me suspect an axis order issue. The code contains the following
> line:
>
> Le 03/12/2019 à 17:42, Thierry Danard a écrit :
>
> DirectPosition position = new DirectPosition2D(inputLat, inputLong);
>
> which (latitude, longitude), but the WKT shows the following:
>
>   SourceCRS[GeodeticCRS["AGD66", (...snip...)
>     CS[ellipsoidal, 2],
>       Axis["Geodetic longitude (Lon)", east],
>       Axis["Geodetic latitude (Lat)", north]
>
> which is (longitude, latitude). Can you check if it solves the problem?
>
> As a side note, we started to implement GIGS tests in GeoAPI a long time
> ago. Those tests are designed for execution with any GeoAPI implementation,
> not only Apache SIS. It does not yet cover the 5000 series, but I have this
> long standing which to complete those tests some day.
>
>
> https://github.com/opengeospatial/geoapi/tree/master/geoapi-conformance/src/main/java/org/opengis/test/referencing/gigs
>
> Second note: EPSG is in process of updating the GIGS tests right now. I do
> not know when the updated version will be ready.
>
>     Martin
>
>
>

Reply via email to