sis-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thierry Danard <thierry.dan...@int.com>
Subject Re: Conversion from WGS 84 to NAD27 / Alaska Albers
Date Mon, 06 Jan 2020 22:02:13 GMT
We built with the latest code and it fixes the error that we reported.
Thanks!

We have one more below that gives a bigger error (still in Alaska!) than we
expected. Do you have any idea?

public void Transform2964_1693_Test() throws FactoryException,
MismatchedDimensionException, TransformException {
        double latitude = 61;
        double longitude = -135;
        double x = 3314991.01765517;
        double y = 4493850.4355215;
        CRSAuthorityFactory crsFactory = CRS.getAuthorityFactory("EPSG");
        CoordinateOperationAuthorityFactory opFactory =
(CoordinateOperationAuthorityFactory) crsFactory;

        // This is the transformation we want to go from Nad27 to WGS84 -
NAD_1927_To_WGS_1984_33
        CoordinateOperation datumOperation =
opFactory.createCoordinateOperation("1693");

        // NAD_1927_Alaska_Albers_Feet
        CoordinateReferenceSystem targetCRS =
crsFactory.createCoordinateReferenceSystem("2964");

        // normalize the axis for the target
        targetCRS =
AbstractCRS.castOrCopy(targetCRS).forConvention(AxesConvention.DISPLAY_ORIENTED);

        CoordinateOperation targetOperation =
CRS.findOperation(datumOperation.getSourceCRS(), targetCRS, null);

        /*
         * We have two operations: WGS84 -> Nad27 and Nad27 to X,Y to
concatenate
         */
        MathTransform step1 = datumOperation.getMathTransform().inverse();
        MathTransform step2 = targetOperation.getMathTransform();

        MathTransform completeTransform = MathTransforms.concatenate(step1,
step2);

        /*
         * transform to x,y in one step
         */
        DirectPosition source = new DirectPosition2D(latitude, longitude);
        DirectPosition target = completeTransform.transform(source, null);

        double[] coordinate = target.getCoordinate();

        Assert.assertEquals(x, coordinate[0], 10);
        Assert.assertEquals(y, coordinate[1], 10);
    }



On Mon, Jan 6, 2020 at 12:08 PM Martin Desruisseaux <
martin.desruisseaux@geomatys.com> wrote:
>
> Hello Thierry
>
> Le 06/01/2020 à 16:58, Thierry Danard a écrit :
>
> > Thank you for the answer
> >
> > I'd like to build from the master
> >
> I just pushed a cherry-pick of geoapi-4.0 branch to master. You should
> be able to run "mvn install" and test again (note: building requires
> Java 13, even if the resulting JAR files are Java 8 compatible). Please
> let me know if there is any issue.
>
>      Martin
>

Mime
View raw message