From: LSA <ls...@ng...> - 2010-09-02 10:31:49
|
Hi everyone! I have the following code: final MathTransform transform = CRS.findMathTransform( getCoordinateReferenceSystem(), coordinateReferenceSystem, false ); Geometry polygonGeom = (Geometry) feature.getDefaultGeometry(); for (Coordinate coordinate : polygonGeom.getCoordinates()) { Coordinate newCoordinate = new Coordinate(); JTS.transform( coordinate, newCoordinate, transform); System.out.println(coordinate + " " + newCoordinate); outlineCoordinates.add(newCoordinate); } Code prints the following: (-5793154.948834527, 1.0266633879513998E7, 10.0) (500000.00000000064, 9997964.943021908, NaN) (-5791913.0310257785, 1.026388223858327E7, 10.0) (500000.00000000064, 9997964.943021908, NaN) (-5798564.847070627, 1.026075134810699E7, 10.0) (500000.00000000064, 9997964.943021908, NaN) (-5800074.930806365, 1.0263622377675956E7, 10.0) (500000.00000000064, 9997964.943021908, NaN) (-5793154.948834527, 1.0266633879513998E7, 10.0) (500000.00000000064, 9997964.943021908, NaN) So, one can notice that every point of my polygon is projected to single (500000.00000000064, 9997964.943021908, NaN). Source CRS is: PROJCS["WGS 84 / UTM zone 32N", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Transverse_Mercator"], PARAMETER["central_meridian", 9.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["scale_factor", 0.9996], PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH], AUTHORITY["EPSG","32632"]] Target CRS is: PROJCS["WGS 84 / UTM zone 17N", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Transverse_Mercator"], PARAMETER["central_meridian", -81.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["scale_factor", 0.9996], PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH], AUTHORITY["EPSG","32617"]] Need help! |