Hello Clay

I'm glad if the tip could help!

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

(…snip…)

     DirectPosition ptSrc = new DirectPosition2D(300000, 5200000);
     DirectPosition ptNad27 = conversion.getMathTransform().transform(ptSrc, 
null);                     
     DirectPosition ptWgs84 = transform.getMathTransform().transform(ptNad27, 
null);

This works just fine but I wonder whether there is more efficient way to do 
this ?  May I chain the conversion and transform operations together into one 
operation in order to convert my NAD27 based projection CRS to WGS84 in one 
step?

Yes, it is always more efficient and sometime more accurate to concatenate the transforms. Internally SIS will erase operations that cancel each other such as conversions from radians to degrees to radians. It can be done as below:

   MathTransform mt = MathTransforms.concatenate(conversion.getMathTransform(), 
transform.getMathTransform());
   DirectPosition ptWgs84 = mt.transform(ptSrc, null);

If transforming a large amount of points, the transform methods working on float[] or double[] arrays will also be more efficient than the method working on a DirectPosition.

    Martin


Reply via email to