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

OperationNotFoundException thrown for some pairs of CRS when the EPSG database is not available

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.8
    • Component/s: Referencing
    • Labels:
      None

      Description

      The following code work correctly when the EPSG geodetic dataset is available in the running environment:

      CoordinateReferenceSystem fromWkt = CRS.fromWKT(
              "PROJCS[\"AGD66 / AMG zone 49\","
              + "GEOGCS[\"AGD66\","
              +   "DATUM[\"Australian_Geodetic_Datum_1966\","
              +     "SPHEROID[\"Australian National Spheroid\",6378160,298.25,AUTHORITY[\"EPSG\",\"7003\"]],"
              +     "TOWGS84[-117.808,-51.536,137.784,0.303,0.446,0.234,-0.29],AUTHORITY[\"EPSG\",\"6202\"]],"
              +     "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"
              +     "UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],"
              +   "AUTHORITY[\"EPSG\",\"4202\"]],"
              +   "PROJECTION[\"Transverse_Mercator\"],"
              +   "PARAMETER[\"latitude_of_origin\",0],"
              +   "PARAMETER[\"central_meridian\",111],"
              +   "PARAMETER[\"scale_factor\",0.9996],"
              +   "PARAMETER[\"false_easting\",500000],"
              +   "PARAMETER[\"false_northing\",10000000],"
              +   "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],"
              +   "AXIS[\"Easting\",EAST],"
              +   "AXIS[\"Northing\",NORTH],"
              + "AUTHORITY[\"EPSG\",\"20249\"]]");
      
      CoordinateOperation coordinateOperation = CRS.findOperation(CommonCRS.WGS84.geographic(), fromWkt, null);
      
      DirectPosition2D wgs84Position = new DirectPosition2D(-37.84, 114.0);
      DirectPosition epsg20249Position = coordinateOperation.getMathTransform().transform(wgs84Position, null);
      

      However, when executed in an environment without EPSG geodetic dataset, we get:

      org.opengis.referencing.operation.OperationNotFoundException: Coordinate conversion of transformation from system “ellipsoidal” to “Cartesian” has not been found.
              at org.apache.sis.referencing.operation.transform.CoordinateSystemTransform.create(CoordinateSystemTransform.java:212)
              at org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory.createCoordinateSystemChange(DefaultMathTransformFactory.java:1235)
              at org.apache.sis.referencing.operation.CoordinateOperationFinder.createOperationStep(CoordinateOperationFinder.java:499)
              at org.apache.sis.referencing.operation.CoordinateOperationFinder.createOperation(CoordinateOperationFinder.java:269)
              at org.apache.sis.referencing.operation.CoordinateOperationFinder.createOperationStep(CoordinateOperationFinder.java:329)
              at org.apache.sis.referencing.operation.CoordinateOperationFinder.createOperation(CoordinateOperationFinder.java:258)
              at org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:731)
              at org.apache.sis.referencing.CRS.findOperation(CRS.java:310)
      ….
      Caused by: java.lang.IllegalArgumentException: Incompatible coordinate system types.
              at org.apache.sis.referencing.cs.CoordinateSystems.swapAndScaleAxes(CoordinateSystems.java:290)
              at org.apache.sis.referencing.operation.transform.CoordinateSystemTransform.create(CoordinateSystemTransform.java:191)
              ... 31 more
      

        Attachments

          Activity

            People

            • Assignee:
              desruisseaux Martin Desruisseaux
              Reporter:
              desruisseaux Martin Desruisseaux
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: