Hey
I am using geotools 2.5.6. I am having a strange issue. I was wondering if
anyone else has encountered this. I am trying to transform a POINT from lat
long i.e. EPSG:4326 to EPSG:32615. I have tried two functions i.e.
CRS.decode and CRS.parseWKT. decode is getting me the right values, but not
parseWKT although the WKT text is the same as the value of the
COordinateReferenceSystem object as returned from decode. I was wondering
about the reason for this. Here is the code that i use to test out this
theory.
Code:
public void testTransform() throws Exception
{
Point latLong = new Point();
latLong.setX(-92.20987681324226);
latLong.setY(34.048943723335704);
String Wkt4326 = "GEOGCS[" + "\"WGS 84\"," + " DATUM[" + "\"World
Geodetic System 1984\","
+ " SPHEROID[\"WGS
84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],"
+ " AUTHORITY[\"EPSG\",\"6326\"]],"
+ " PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"
+ " UNIT[\"degree\",0.017453292519943295],"
+ " AXIS[\"Geodetic longitude\",EAST]," + " AXIS[\"Geodetic
latitude\",NORTH],"
+ " AUTHORITY[\"EPSG\",\"4326\"]]";
String Wkt32615 = "PROJCS[\"WGS 84 / UTM zone 15N\"," +
"GEOGCS[\"WGS 84\"," +
"DATUM[\"World Geodetic System 1984\"," +
"SPHEROID[\"WGS 84\",6378137,298.257223563," +
"AUTHORITY[\"EPSG\",\"7030\"]]," +
"AUTHORITY[\"EPSG\",\"6326\"]]," +
"PRIMEM[\"Greenwich\",0," +
"AUTHORITY[\"EPSG\",\"8901\"]]," +
"UNIT[\"degree\",0.01745329251994328]," +
"AUTHORITY[\"EPSG\",\"4326\"]]," +
"UNIT[\"m\",1]," +
"PROJECTION[\"Transverse_Mercator\"]," +
"PARAMETER[\"latitude_of_origin\",0]," +
"PARAMETER[\"central_meridian\",-105]," +
"PARAMETER[\"scale_factor\",0.9996]," +
"PARAMETER[\"false_easting\",500000]," +
"PARAMETER[\"false_northing\",0]," +
"AUTHORITY[\"EPSG\",\"32615\"]," +
"AXIS[\"Easting\",EAST]," +
"AXIS[\"Northing\",NORTH]]";
//CoordinateReferenceSystem sourceCRS = CRS.parseWKT(Wkt4326);
//CoordinateReferenceSystem targetCRS = CRS.parseWKT(Wkt32615);
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326", true);
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:32615");
MathTransform transform = CRS.findMathTransform(sourceCRS,
targetCRS);
Geometry jtsPointGeometry =
RunEventGisUtilities.convertPostgisToJTS(latLong);
jtsPointGeometry = JTS.transform(jtsPointGeometry, transform);
}
Here are the correct values for the transformed coordinates:
This is what i get from decode which is correct
POINT(-92.20987681324226 34.048943723335704) --> POINT (572925.1581415016
3767864.3268143334)
This is what i get from parseWKT which is incorrect
POINT(-92.20987681324226 34.048943723335704) --> POINT (1684114.104384322
3842326.483685698)
Does anyone have any ideas for the discrepancy ?
--
View this message in context:
http://n2.nabble.com/CRS-parseWKT-not-returning-same-values-as-CRS-decode-tp3569089p3569089.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users