Hello,

I perform this test:

    @Test
    public void testNad27utm12N() throws FactoryException, Exception {
        CoordinateReferenceSystem fromCrs = CRS.forCode("EPSG:26912");
        CoordinateReferenceSystem toCrs = CRS.forCode("EPSG:4326");
        CoordinateReferenceSystem displayOrientedFromCrs =
AbstractCRS.castOrCopy(fromCrs).forConvention(AxesConvention.DISPLAY_ORIENTED);
        CoordinateReferenceSystem displayOrientedToCrs =
AbstractCRS.castOrCopy(toCrs).forConvention(AxesConvention.DISPLAY_ORIENTED);
        double x = 402684.34;
        double y = 6028836.49;
        CoordinateOperation operation =
CRS.findOperation(displayOrientedFromCrs, displayOrientedToCrs,
ExtentUtil.getExtentFromAreaOfUse(displayOrientedFromCrs, x, y, x, y));
        DirectPosition position = new DirectPosition2D(x, y);
        double[] coordinate =
operation.getMathTransform().transform(position, position).getCoordinate();
    }

public class ExtentUtil {

    public static DefaultGeographicBoundingBox
getExtentFromAreaOfUse(CoordinateReferenceSystem displayOrientedFromCrs,
            double minX, double minY, double maxX, double maxY) throws
Exception {
        CoordinateReferenceSystem toCrs = CRS.forCode("EPSG:4326");
        AbstractCRS displayOrientedToCrs =
AbstractCRS.castOrCopy(toCrs).forConvention(AxesConvention.DISPLAY_ORIENTED);
// longitude should be first
        CoordinateOperation operation =
CRS.findOperation(displayOrientedFromCrs, displayOrientedToCrs, null);
        MathTransform mt = operation.getMathTransform();
        DirectPosition topLeftPosition = new DirectPosition2D(minX, maxY);
        DirectPosition topRightPosition = new DirectPosition2D(maxX, maxY);
        DirectPosition bottomRightPosition = new DirectPosition2D(maxX,
minY);
        DirectPosition bottomLeftPosition = new DirectPosition2D(minX,
minY);
        DirectPosition topLeftLatLongPosition =
mt.transform(topLeftPosition, topLeftPosition);
        DirectPosition topRightLatLongPosition =
mt.transform(topRightPosition, topRightPosition);
        DirectPosition bottomLeftLatLongPosition =
mt.transform(bottomLeftPosition, bottomLeftPosition);
        DirectPosition bottomRightLatLongPosition =
mt.transform(bottomRightPosition, bottomRightPosition);
        double westBoundLongitude =
Math.min(topLeftLatLongPosition.getCoordinate()[0],
bottomLeftLatLongPosition.getCoordinate()[0]);
        double eastBoundLongitude =
Math.max(topLeftLatLongPosition.getCoordinate()[0],
bottomLeftLatLongPosition.getCoordinate()[0]);
        double southBoundLatitude =
Math.min(topRightLatLongPosition.getCoordinate()[1],
bottomRightLatLongPosition.getCoordinate()[1]);
        double northBoundLatitude =
Math.max(topRightLatLongPosition.getCoordinate()[1],
bottomRightLatLongPosition.getCoordinate()[1]);
        return new DefaultGeographicBoundingBox(westBoundLongitude,
eastBoundLongitude, southBoundLatitude, northBoundLatitude);
    }

}

And I get this message:

Oct 31, 2019 1:56:52 PM
org.apache.sis.referencing.operation.CoordinateOperationFinder
createOperations
WARNING: Can not parse “AB_CSRS.DAC” as a file in the NTv2 format.

Two questions:

1/ Where does the Apache SIS library get this  “AB_CSRS.DAC” file from, and
what does it do? It's not hard-coded in the Apache SIS code from what I can
see. Maybe it's referenced in a .gsb file. I updated my .gsb files from
https://webapp.geod.nrcan.gc.ca/geod/data-donnees/transformations.php, but
I get the same error, despite having a ABCSRSV4.GSB file present.

2/ Where can I download this  AB_CSRS.DAC file?



In case this helps. the string of the operation has warnings:

Operation: ConcatenatedOperation["ProjectedCRS[“NAD_1983_UTM_Zone_12N”] ?
Geographic2D[“WGS 84”]",
  SourceCRS[ProjectedCRS["NAD_1983_UTM_Zone_12N",
    BaseGeodCRS["GCS_North_American_1983",
      Datum["D_North_American_1983",
        Ellipsoid["GRS_1980", 6378137.0, 298.257222101]],
      Unit["degree", 0.017453292519943295]],
    Conversion["Transverse_Mercator",
      Method["Transverse Mercator"],
      Parameter["Latitude of natural origin", 0.0],
      Parameter["Longitude of natural origin", -111.0],
      Parameter["Scale factor at natural origin", 0.9996],
      Parameter["False easting", 500000.0],
      Parameter["False northing", 0.0]],
    CS[Cartesian, 2],
      Axis["Easting (E)", east],
      Axis["Northing (N)", north],
      Unit["metre", 1]]],
  TargetCRS[GeodeticCRS["WGS 84",
    Datum["World Geodetic System 1984",
      Ellipsoid["WGS 84", 6378137.0, 298.257223563]],
    CS[ellipsoidal, 2],
      Axis["Geodetic longitude (Lon)", east],
      Axis["Geodetic latitude (Lat)", north],
      Unit["degree", 0.017453292519943295],
    Id["CRS", 84, Citation["WMS"]]]],
  CoordinateOperationStep["Inverse operation",
    Method["Inverse of Transverse Mercator"],
      Parameter["Longitude of natural origin", -111.0, Unit["degree",
0.017453292519943295]],
      Parameter["Scale factor at natural origin", 0.9996, Unit["unity", 1]],
      Parameter["False easting", 500000.0, Unit["metre", 1]]],
  CoordinateOperationStep["Ellipsoid change",
    Method["Abridged Molodensky"],
      Parameter["X-axis translation", 0.0, Unit["metre", 1]],
      Parameter["Y-axis translation", 0.0, Unit["metre", 1]],
      Parameter["Z-axis translation", 0.0, Unit["metre", 1]],
      Parameter["Semi-major axis length difference", 0.0, Unit["metre", 1]],
      Parameter["Flattening difference", -1.6434736350128572E-11,
Unit["unity", 1]],
    OperationAccuracy[3000.0]]]

Warnings:
  • Can not represent “Inverse operation” in a strictly standard-compliant
WKT format.
  • Can not represent “Ellipsoid change” in a strictly standard-compliant
WKT format.
  • Can not represent “ProjectedCRS[“NAD_1983_UTM_Zone_12N”] ?
Geographic2D[“WGS 84”]” in a strictly standard-compliant WKT format.

Reply via email to