This coordref test fails!!
--------------------------

                 Key: GEOT-1428
                 URL: http://jira.codehaus.org/browse/GEOT-1428
             Project: GeoTools
          Issue Type: Test
          Components: core referencing
    Affects Versions: 2.3.3
         Environment: Windows XP Pro, JAI 1.1.3, Java 1.5.12
            Reporter: Rafal Glowinski
            Assignee: Martin Desruisseaux


Another test case for Poland. This one fails :(

Transformation of point 304 from EUREF-POL point number 304 
(http://www.cbk.waw.pl/zgp/proj/eurefpol_pl.html#Tab) given in EPSG:2180 
Coordref System to EPSG:2173 CoordrefSystem. Both of those systems are local 
for Poland. 

1) Transformation: EPSG:2180 ----> EPSG:2173
Point 304[EPSG:2180] (652629.45871, 310593.99113)
Point 304[EPSG:2173] (6012822.17515, 3443105.22912)
Point 304[RESULT] (6012784.025, 3442979.07)

The difference is not large: (38.15015, 126.15912)

2) Reverse Transformation: EPSG:2173:Result ----> EPSG:2180
Point 304[EPSG:2173:RESULT] (6012784.025, 3442979.07)
Point 304[EPSG:2180:RESLT] (652629.459, 310593.991)

So the transformation can be reveresed - thats a good news, but why the results 
are so inaccurate?

The JAVA Code:
                try
                {       
                        String csEPSG_2180 = "PROJCS[\"ETRS89 / Poland CS92\", 
" + 
                                                                 
"GEOGCS[\"ETRS89\", "+ 
                                                                 
"DATUM[\"European_Terrestrial_Reference_System_1989\", " + 
                                                                 
"SPHEROID[\"GRS 1980\", 6378137.0, 298.257222101, 
AUTHORITY[\"EPSG\",\"7019\"]], " + 
                                                                 
"AUTHORITY[\"EPSG\",\"6258\"]], " +
                                                                 
"PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]], " + 
                                                                 
"UNIT[\"degree\", 0.017453292519943295], " + 
                                                                 "AXIS[\"Lon\", 
EAST], " + 
                                                                 "AXIS[\"Lat\", 
NORTH], " + 
                                                                 
"AUTHORITY[\"EPSG\",\"4258\"]], " + 
                                                                 
"PROJECTION[\"Transverse_Mercator\"], " + 
                                                                 
"PARAMETER[\"central_meridian\", 19.0], " + 
                                                                 
"PARAMETER[\"latitude_of_origin\", 0.0], " + 
                                                                 
"PARAMETER[\"scale_factor\", 0.9993], " + 
                                                                 
"PARAMETER[\"false_easting\", 500000.0], " + 
                                                                 
"PARAMETER[\"false_northing\", -5300000.0], " + 
                                                                 "UNIT[\"m\", 
1.0], " + 
                                                                 "AXIS[\"x\", 
NORTH], " + 
                                                                 "AXIS[\"y\", 
EAST], " + 
                                                                 
"AUTHORITY[\"EPSG\",\"2180\"]]";
                        
                        String csEPSG_2173 = "PROJCS[\"Pulkovo 1942(58) / 
Poland zone III\", " + 
                                                                 
"GEOGCS[\"Pulkovo 1942(58)\", " + 
                                                                 
"DATUM[\"Pulkovo_1942_58\", " + 
                                                                 
"SPHEROID[\"Krassowsky 1940\", 6378245.0, 298.3, AUTHORITY[\"EPSG\",\"7024\"]], 
" + 
                                                                 "TOWGS84[33.4, 
-146.6, -76.3, -0.359, -0.053, 0.844, -0.84], " + 
                                                                 
"AUTHORITY[\"EPSG\",\"6179\"]], " + 
                                                                 
"PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]], " + 
                                                                 
"UNIT[\"degree\", 0.017453292519943295], " + 
                                                                 "AXIS[\"Lon\", 
EAST], " + 
                                                                 "AXIS[\"Lat\", 
NORTH], " + 
                                                                 
"AUTHORITY[\"EPSG\",\"4179\"]], " + 
                                                                 
"PROJECTION[\"Oblique_Stereographic\"], " + 
                                                                 
"PARAMETER[\"central_meridian\", 17.00833333333333], " + 
                                                                 
"PARAMETER[\"latitude_of_origin\", 53.583333333333336], " + 
                                                                 
"PARAMETER[\"scale_factor\", 0.9998], " + 
                                                                 
"PARAMETER[\"false_easting\", 3501000.0], " + 
                                                                 
"PARAMETER[\"false_northing\", 5999000.0], " + 
                                                                 "UNIT[\"m\", 
1.0], " + 
                                                                 "AXIS[\"x\", 
NORTH], " + 
                                                                 "AXIS[\"y\", 
EAST], " + 
                                                                 
"AUTHORITY[\"EPSG\",\"2173\"]]";

                        /*
                        CRSAuthorityFactory   factory = 
FactoryFinder.getCRSAuthorityFactory("EPSG", null);
                        CoordinateReferenceSystem crs_src = 
factory.createCoordinateReferenceSystem("EPSG:2180");                       
                        CoordinateReferenceSystem crs_dest = 
factory.createCoordinateReferenceSystem("EPSG:2173");                      
                        */
                        
                        CRSFactory crsFactory = 
FactoryFinder.getCRSFactory(null);
                        CoordinateReferenceSystem crs_src = 
crsFactory.createFromWKT(csEPSG_2180);
                        CoordinateReferenceSystem crs_dest = 
crsFactory.createFromWKT(csEPSG_2173);
                        
                        Hints hints = new Hints(Hints.LENIENT_DATUM_SHIFT, 
Boolean.TRUE);
                        
                        // przeliczenia
                        DefaultCoordinateOperationFactory trFactory = new 
DefaultCoordinateOperationFactory(hints);     
                        
                        /*
                         * 1992 -> 1965/3
                         * 304 (652629.45871, 310593.99113)
                         */
                        DirectPosition pt304_1992 = new 
DirectPosition2D(crs_src, 652629.45871, 310593.99113);
                        System.out.println("Before tranform: " + 
pt304_1992.toString());
                        
                        CoordinateOperation o1992_to_1965_3 = 
trFactory.createOperation(crs_src, crs_dest);
                        DirectPosition pt304_1965_3 = 
o1992_to_1965_3.getMathTransform().transform(pt304_1992, null);
                        System.out.println("After tranform: " + 
pt304_1965_3.toString());
                        
                        /*
                         * Reverse Transform
                         * 1965/3 (Result) -> 1992
                         */
                        CoordinateOperation o1965_3_to_1992 = 
trFactory.createOperation(crs_dest, crs_src);
                        pt304_1992 = 
o1965_3_to_1992.getMathTransform().transform(pt304_1965_3, null);
                        System.out.println("After reverse tranform: " + 
pt304_1992.toString());
                        
                        int a = 0;
                }
                catch (Exception e)
                {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }




-- 
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

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to