I have a problem when converting from Korean 2000 Coordinates System (EPSG:5179) to Decimal Degree (EPSG:4326).
We are developing Geographical Information System for Korean company. We were using Geotools library for mulitiple backend implementations. However I have problem now with conversion from EPSG:5179 to EPSG:4326. For example: when using multiple online converters like https://epsg.io/transform#s_srs=5179&t_srs=4326 trying to to convert korean coordinate: x : 1307285 y : 2229260
an expected results are (in decimal degree format): x : 131.0999928 y : 40.0099722
So now i'm trying to use Geotools library to do same convertion using this documentation http://docs.geotools.org/stable/userguide/library/api/jts.html
My example test:
public void testProjectedKoreanCoordinatesToDecimalDegree() throws FactoryException, TransformException {
//EPSG:5179 -> EPSG:4326 CONVERSION
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:5179");
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
double coordinateX = 1307285;
double coordinateY = 2229260;
Coordinate in = new Coordinate(coordinateX, coordinateY);
Coordinate out = in;
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
Coordinate result = JTS.transform(in, out, transform);
DegreeCoordinates degreeCoordinates = DegreeCoordinates.fromJTSCoordinate(result);
double expectedLongitude = 131.0999928;
double expectedLatitude = 40.0099721;
assertEquals(expectedLongitude, degreeCoordinates.getLongitude(), 0.00001);
assertEquals(expectedLatitude, degreeCoordinates.getLatitude(), 0.00001);
}
So that test fails at first coordinate comparison, actual output is: longitude : 140.340217725
when longitude should be 131.0999928
Do you have any suggestion what i am doing wrong ? Thank you in advance !