Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-489

Inaccurate result for MGI Ferro transform (see test case attached)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 1.0
    • 1.1
    • Referencing
    • None

    Description

      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);
          }
      

      Attachments

        Activity

          People

            desruisseaux Martin Desruisseaux
            olivier@geotoolkit.net Olivier Lhemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: