Martin Desruisseaux created SIS-327:
---------------------------------------
Summary: Defer loading of datum shift grid files
Key: SIS-327
URL: https://issues.apache.org/jira/browse/SIS-327
Project: Spatial Information Systems
Issue Type: Improvement
Components: Referencing
Reporter: Martin Desruisseaux
Priority: Minor
Fix For: 0.7
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.
{code:java}
CoordinateReferenceSystem sourceCRS = CRS.forCode("EPSG:4267");
CoordinateReferenceSystem targetCRS = CRS.forCode("EPSG:4326");
CoordinateOperation op = CRS.findOperation(sourceCRS, targetCRS, null);
{code}
*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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)