Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.7
-
None
Description
When a CoordinateOperation is created, its MathTransform is created immediately. This is usually not so costly, except in the case of datum shift based on a grid files where the grid files is loaded immediately. This is a waste of resources when the caller needs create many such operations, compare their domainOfValidity and retain only one operation at the end.
The proposal is to load the datum shift grid files only the first time that getMathTransform() is invoked. In addition to reduce the amount of resources to load, another effect of this would be to reduce the amount of warnings emitted because of grid files not present.
How to reproduce: the snippet below produces a lot of warnings if the grid files are not present. After this issue is fixed, we should have at most 1 warning.
CoordinateReferenceSystem sourceCRS = CRS.forCode("EPSG:4267"); CoordinateReferenceSystem targetCRS = CRS.forCode("EPSG:4326"); CoordinateOperation op = CRS.findOperation(sourceCRS, targetCRS, null);
Note: we could defer the creation of all MathTransform objects, but this is advantageous only for the cases where many operations exist between the same pair of CRS. This is the case of datum shift mostly.