I'm trying to transform EPSG:27700 coordinates to latitude and longitude. From my research I understand that WGS 84 (EPSG:4326) is the SRS that resembles latitude and longitude.
I'm using Proj4j to try and convert a test coordinate (those familiar with my previous question will recognise Kirkby In Ashfield station).
My Java code snippet:
String projection27700 = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 "
+ "+x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs";
CRSFactory crsFactory = new CRSFactory();
CoordinateReferenceSystem sourceSRS = crsFactory.createFromParameters(null,
projection27700);
String projection4326 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
CoordinateReferenceSystem targetSRS = crsFactory.createFromParameters(null,
projection4326);
CoordinateTransform transformation = new BasicCoordinateTransform(sourceSRS,
targetSRS);
ProjCoordinate result = new ProjCoordinate();
ProjCoordinate input = new ProjCoordinate(450077, 356089);
transformation.transform(input, result);
System.out.println(result.x + ", " + result.y);
The result printed is:
-155.20355661333892, -35.91545136124713
This doesn't seem right – it neither makes sense as degrees or metres (to me at least). Have I missed out a conversion somewhere, either on my input data or in this output data I've produced?
I'm fairly happy my input data is right, based on this documentation, which confirms that +units=m
will allow my input data to be in metres. It also suggests the output data should be in degrees, which is what I want.
Best Answer
I haven't solved the original problem, but I've worked around it by using CTS instead.
This produces:
[-1.2535570562769147, 53.09965984661543]
which is the correct answer.