Wrong conversion when using a vertical CRS and feet
---------------------------------------------------

                 Key: GEOT-3588
                 URL: http://jira.codehaus.org/browse/GEOT-3588
             Project: GeoTools
          Issue Type: Bug
          Components: core referencing
    Affects Versions: 2.7.1
         Environment: Windows 7, Java 1.6
            Reporter: Nils Grøstad
            Priority: Minor


In the following program, initially the correct result is printed, but when 
adding a vertical CRS, 
the result is wrong. Note that feet are used. An initial analysis indicates 
that the problem is the 
conversion betwen meter and feet being applied multiple times, but I have not 
been able to find a way
to fix this. The problem occurs both with a vertical CRS in meter and in feet.

public class TestConversion {

        public static void main(String[] args) throws Exception {
                
                CoordinateReferenceSystem crs = CRS.decode("EPSG:32038");  // 
NAD27 Texas North Central, feet
                MathTransform local2geo3D = CRS.findMathTransform(crs, 
DefaultGeographicCRS.WGS84_3D);
                
                DirectPosition p = new GeneralDirectPosition(2220135.84, 
716913.45, 0);
                p = local2geo3D.transform(p, null);
                double lon = p.getCoordinate()[0];
                double lat = p.getCoordinate()[1];
                
                System.out.println("Lat " + lat + " lon " + lon); // Correct 
result: Lat 33.63 lon -96.77
                
                // Adding a vertical CRS:
                CoordinateReferenceSystem local3D = new 
DefaultCompoundCRS(crs.getName().toString(), 
                                crs, DefaultVerticalCRS.ELLIPSOIDAL_HEIGHT);
                local2geo3D = CRS.findMathTransform(local3D, 
DefaultGeographicCRS.WGS84_3D);
                
                p = new GeneralDirectPosition(2220135.84, 716913.45, 0);
                p = local2geo3D.transform(p, null);
                lon = p.getCoordinate()[0];
                lat = p.getCoordinate()[1];

                System.out.println("Lat " + lat + " lon " + lon); // Wrong 
result: Lat 31.71 lon -103.27
        }
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to