JTS.orthodromicDistance fails for DefaultGeographicCRS.WGS84
------------------------------------------------------------

                 Key: GEOT-942
                 URL: http://jira.codehaus.org/browse/GEOT-942
             Project: GeoTools
          Issue Type: Bug
    Affects Versions: 2.3.M0, 2.3
            Reporter: Aleksander Bandelj


This affects UDIG, which uses the following to calculate scale:

diagonalGroundDistance = JTS.orthodromicDistance(new Coordinate(restrictedBounds
                                        .getMinX(), 
restrictedBounds.getMinY()), new Coordinate(restrictedBounds
                                        .getMaxX(), 
restrictedBounds.getMaxY()), DefaultGeographicCRS.WGS84);

For example:

JTS.orthodromicDistance(new Coordinate(1, 1), new Coordinate(2, 2), 
DefaultGeographicCRS.WGS84);

gives

java.lang.IllegalArgumentException: Argument "crs" should not be null.
        at 
org.geotools.geometry.TransformedDirectPosition.ensureNonNull(TransformedDirectPosition.java:338)
        at 
org.geotools.geometry.TransformedDirectPosition.setCoordinateReferenceSystem(TransformedDirectPosition.java:204)
        at 
org.geotools.geometry.GeneralDirectPosition.setLocation(GeneralDirectPosition.java:275)
        at 
org.geotools.geometry.TransformedDirectPosition.transform(TransformedDirectPosition.java:259)
        at 
org.geotools.referencing.GeodeticCalculator.setStartingPosition(GeodeticCalculator.java:596)
        at org.geotools.geometry.jts.JTS.orthodromicDistance(JTS.java:355)

Reason is probably optimization in TransformedDirectPosition constructor since 
2.2:

defaultCRS = CRSUtilities.equalsIgnoreMetadata(sourceCRS, targetCRS) ? null : 
sourceCRS;

which leaves crs as null




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

        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to