*/
private static void transform( CoordinateReferenceSystem coordCRS,
CoordinateReferenceSystem destinationCRS, Coordinate[] coordinates ) throws Exception {
if( coordCRS==null || destinationCRS==null)
return;
MathTransform mt = CRS.findMathTransform(coordCRS, destinationCRS, true );
if (mt == null || mt.isIdentity())
return;
double[] coords = new double[coordinates.length * 2];
for( int i = 0; i < coordinates.length; i++ ) {
coords[i * 2] = coordinates[i].x;
coords[i * 2 + 1] = coordinates[i].y;
}
mt.transform(coords, 0, coords, 0, coordinates.length);
for( int i = 0; i < coordinates.length; i++ ) {
coordinates[i].x = coords[i * 2];
coordinates[i].y = coords[i * 2 + 1];
}
}