WKTParser { public static CRS parse( String wkt ) throws IOException { WKTParser parse = new WKTParser( new BufferedReader( new StringReader( wkt ) ) ); return parse.parseCoordinateSystem(); } WKTParser( String fileName ); private  WKTParser( Reader reader );  WKTParser( File fileName ); CRS parseCoordinateSystem(); static CRS parse( String wkt );  }
@Test public void testProjectedCS() throws IOException { String s = buildPROJCS( projCRSName, projCRSCode, "Meter", 1.0 ); CRS cs = WKTParser.parse( s ); Assert.assertTrue( cs instanceof ProjectedCRS ); ProjectedCRS projCRS = (ProjectedCRS) cs; Assert.assertEquals( projCRSName, projCRS.getName() ); Assert.assertEquals( projCRSName + ":" + projCRSCode, projCRS.getCode().getOriginal() ); Assert.assertEquals( "x", projCRS.getAxis()[0].getName() ); Assert.assertEquals( "east", projCRS.getAxis()[0].getOrientationAsString() ); Assert.assertEquals( "y", projCRS.getAxis()[1].getName() ); Assert.assertEquals( "north", projCRS.getAxis()[1].getOrientationAsString() ); IGeographicCRS geographicCRS = projCRS.getGeographicCRS(); Assert.assertEquals( geogCRSName, geographicCRS.getName() ); Assert.assertEquals( geogCRSName + ":" + geogCRSCode, geographicCRS.getCode().getOriginal() ); Assert.assertEquals( "Longitude", geographicCRS.getAxis()[0].getName() ); Assert.assertEquals( "east", geographicCRS.getAxis()[0].getOrientationAsString() ); Assert.assertEquals( "Latitude", geographicCRS.getAxis()[1].getName() ); Assert.assertEquals( "north", geographicCRS.getAxis()[1].getOrientationAsString() ); IDatum datum = geographicCRS.getDatum(); Assert.assertEquals( datumName, datum.getName() ); IEllipsoid ellipsoid = ( (GeodeticDatum) datum ).getEllipsoid(); Assert.assertEquals( ellipsoidName, ellipsoid.getName() ); Assert.assertEquals( ellipsoidName + ":" + ellipsoidCode, ellipsoid.getCode().getOriginal() ); Assert.assertEquals( semiMajorAxis, ellipsoid.getSemiMajorAxis() ); Assert.assertEquals( inverseFlattening, ellipsoid.getInverseFlattening() ); IPrimeMeridian pm = ( (GeodeticDatum) datum ).getPrimeMeridian(); Assert.assertEquals( pmName, pm.getName() ); Assert.assertEquals( pmName + ":" + pmCode, pm.getCode().getOriginal() ); Assert.assertEquals( Unit.DEGREE, pm.getAngularUnit() ); Assert.assertEquals( pmLongitude, pm.getLongitude() ); IProjection proj = projCRS.getProjection(); Assert.assertTrue( proj instanceof LambertConformalConic ); LambertConformalConic lcc = (LambertConformalConic) proj; Assert.assertEquals( falseEasting, lcc.getFalseEasting() ); Assert.assertEquals( falseNorthing, lcc.getFalseNorthing() ); Assert.assertEquals( DTR * stdParallel1, lcc.getFirstParallelLatitude(), 1e-12 ); Assert.assertEquals( DTR * stdParallel2, lcc.getSecondParallelLatitude(), 1e-12 ); Assert.assertEquals( DTR * lonNatOrigin, lcc.getNaturalOrigin().x ); Assert.assertEquals( DTR * latNatOrigin, lcc.getNaturalOrigin().y ); Assert.assertEquals( scaleFactor, lcc.getScale() ); }