Hi,

I'm trying to convert WGS84 lat/lon points to NTF Lambert II
(EPSG:27572) points.

The following code crashes for an unknown reason :

--------------------------------------------------------------------------------------
MathTransform transform = null;
try {           
    CoordinateReferenceSystem sourceCRS = DefaultGeographicCRS.WGS84;
    CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:27572");

    transform = CRS.findMathTransform(sourceCRS, targetCRS, true);              
        
} catch (NoSuchAuthorityCodeException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (FactoryException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
--------------------------------------------------------------------------------------

The stacktrace is the following :
--------------------------------------------------------------------------------------
org.opengis.referencing.FactoryException: Error in "TOWGS84": Can't
parse
"-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903
 (...) 
false_northing",2200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27572"]]"
 because "-" is unrecognized.
   at
org.geotools.referencing.factory.ReferencingObjectFactory.createFromWKT(ReferencingObjectFactory.java:1094)
   at
org.geotools.referencing.crs.EPSGCRSAuthorityFactory.createCoordinateReferenceSystem(EPSGCRSAuthorityFactory.java:191)
   at
org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:798)
   at
org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:729)
   at
org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:179)
   at org.geotools.referencing.CRS.decode(CRS.java:420)
   at org.geotools.referencing.CRS.decode(CRS.java:348)
...
Caused by: java.text.ParseException: Error in "TOWGS84": Can't parse
"-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903
 (...) 
false_northing",2200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27572"]]"
 because "-" is unrecognized.
   at org.geotools.referencing.wkt.Element.<init>(Element.java:163)
   at org.geotools.referencing.wkt.Element.<init>(Element.java:169)
   at org.geotools.referencing.wkt.Element.<init>(Element.java:169)
   at org.geotools.referencing.wkt.Element.<init>(Element.java:169)
   at
org.geotools.referencing.wkt.AbstractParser.getTree(AbstractParser.java:236)
   at
org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:200)
   at
org.geotools.referencing.factory.ReferencingObjectFactory.createFromWKT(ReferencingObjectFactory.java:1088)
   ...8 more
Exception in thread "main" java.lang.NullPointerException
   at
org.geotools.geometry.jts.DefaultCoordinateSequenceTransformer.transform(DefaultCoordinateSequenceTransformer.java:74)
   at
org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer.projectCoordinateSequence(GeometryCoordinateSequenceTransformer.java:184)
   at
org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer.transformPoint(GeometryCoordinateSequenceTransformer.java:171)
   at
org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer.transform(GeometryCoordinateSequenceTransformer.java:86)
   at org.geotools.geometry.jts.JTS.transform(JTS.java:224)
...
--------------------------------------------------------------------------------------

It seems to be a parsing problem :

Error in "TOWGS84": Can't parse
"-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903
 (...) 
false_northing",2200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27572"]]"
 because "-" is unrecognized.

I am using geotools 2.5.1 on a Debian system. I have tested with the Sun
JVM 6 and the openjdk with the same output. The epsg reference is from
gt-epsg-wkt-2.5.1.jar.

The locale of the system is en_US.

I have tried to parse a text string containing "-168" using the same
options as in the AbstractParser.java class without any problem.

Any idea on the problem would very helpful. I can provide more info if
needed.

Thanks in advance,

Didrik

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to