Hello Clay

Le 17/03/2021 à 18:10, Clay Harter a écrit :

I see how I may get a CoordinateOperation to convert from one CRS to another in  a given area of interest by calling CRS.findOperation(sourceCRS, targetCRS, areaOfInterest) . But in the case where the source and target CRS have different datum there may be multiple transforms available. If I know the EPSG code of the transform (datum shift) I wish to use how may I assert it?  In this case I  don’t want SIS to pick it for me.

This is the work of CoordinateOperationAuthorityFactory. An example is below. The first line is a bit of cheating, more on it below.

   import org.opengis.referencing.operation.CoordinateOperationAuthorityFactory;

   (...snip...)

   CoordinateOperationAuthorityFactory opFactory = (CoordinateOperationAuthorityFactory) 
CRS.getAuthorityFactory("EPSG");
   CoordinateOperation op = opFactory.createCoordinateOperation("1172");
   System.out.println(op);

The CRS.getAuthorityFactory(…) method is for fetching a CRSAuthorityFactory. We do not have a public method for fetching the CoordinateOperationAuthorityFactory at this time, but it appears that in the particular case of Apache SIS, the implementation class of CRSAuthorityFactory also implements all other authority factory interfaces. We will provide methods for factories of all types in some future SIS version (it is pending an update of GeoAPI interfaces).

    Martin


Reply via email to