You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by "Olivier Lhemann (Jira)" <ji...@apache.org> on 2020/02/24 22:44:00 UTC
[jira] [Created] (SIS-489) Inaccurate result for MGI Ferro
transform (see test case attached)
Olivier Lhemann created SIS-489:
-----------------------------------
Summary: Inaccurate result for MGI Ferro transform (see test case attached)
Key: SIS-489
URL: https://issues.apache.org/jira/browse/SIS-489
Project: Spatial Information Systems
Issue Type: Bug
Components: Referencing
Reporter: Olivier Lhemann
public void TransformTest() throws FactoryException, MismatchedDimensionException, TransformException {
double latitude = 46.72;
double longitude = 16;
double x = -25097.740155822;
double y = 175686.952118893;
CRSAuthorityFactory crsFactory = CRS.getAuthorityFactory("EPSG");
CoordinateOperationAuthorityFactory opFactory = (CoordinateOperationAuthorityFactory) crsFactory;
// MGI (Ferro) to WGS 84 (1)
CoordinateOperation datumOperation = opFactory.createCoordinateOperation("3966");
// MGI (Ferro) / Austria GK East Zone
CoordinateReferenceSystem targetCRS = crsFactory.createCoordinateReferenceSystem("31253");
// 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 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();
//System.out.println(operation.getSourceCRS().toString());
Assert.assertEquals(x, coordinate[0], 0.1);
Assert.assertEquals(y, coordinate[1], 0.1);
}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)