1
Vote

Convert from British Coordination System to WGS84

description

I've a point in British coordination system. I converted this point to World Geodetic System (WGS84)
Coordination of point is :

POINT (387299.983770336 394174.082801568)

After convert to lat long system it is :

-2.19267975444489 53.4441711379192

The point is in the UK but when I try to display it in google map it displayed near Africa .

Image

I use this code for conversation.
     private const string BritishWKT =
        "PROJCS[\"OSGB 1936 / British National Grid\",GEOGCS[\"OSGB 1936\",DATUM[\"OSGB_1936\",SPHEROID[\"Airy 1830\", 6377563.396, 299.3249646, AUTHORITY[\"EPSG\", \"7001\"]],TOWGS84[375, -111, 431, 0, 0, 0, 0],AUTHORITY[\"EPSG\", \"6277\"]],PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]],UNIT[\"DMSH\", 0.0174532925199433, AUTHORITY[\"EPSG\", \"9108\"]],AXIS[\"Lat\", NORTH],AXIS[\"Long\", EAST],AUTHORITY[\"EPSG\", \"4277\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\", 49],PARAMETER[\"central_meridian\", -2],PARAMETER[\"scale_factor\", 0.999601272],PARAMETER[\"false_easting\", 400000],PARAMETER[\"false_northing\", -100000],UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]],AXIS[\"E\", EAST],AXIS[\"N\", NORTH],AUTHORITY[\"EPSG\", \"27700\"]],VERT_CS[\"Newlyn\",VERT_DATUM[\"Ordnance Datum Newlyn\", 2005, AUTHORITY[\"EPSG\", \"5101\"]],UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]],AXIS[\"Up\", UP],AUTHORITY[\"EPSG\", \"5701\"]],AUTHORITY[\"EPSG\", \"7405\"]]";
        var _britishCoordinationSystem = CoordinateSystemWktReader.Parse(BritishWKT) as IProjectedCoordinateSystem;

                var _wgs84CoordinationSystem = GeographicCoordinateSystem.WGS84;

 var ctfac = new CoordinateTransformationFactory();
        ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(_britishCoordinationSystem,
            _wgs84CoordinationSystem);

        double[] fromPoint = {Convert.ToDouble(txtX.Text), Convert.ToDouble(txtY.Text)};
            // U2U Consult Head Office, in degrees
        double[] toPoint = trans.MathTransform.Transform(fromPoint);
        Lat = toPoint[0].ToString();
        Lon = toPoint[1].ToString();
What's the problem ?

comments

phatcher wrote Feb 16, 2014 at 11:35 PM

When you say British Coordinate System do you mean the OS grid reference, if so it's a non-trivial conversion.

Have a look at http://www.ordnancesurvey.co.uk/business-and-government/help-and-support/navigation-technology/os-net/formats-for-developers.html

Regards

Paul

drhaynes wrote May 4, 2016 at 5:14 PM

You have everything correct. The issue that you're seeing is that you have the lat/long switched.

The conversion function returns coordinates in the form (longitude, latitude), which is not the usual way they are displayed.

If you put the following into google maps, you'll see a more reasonable location:
53.4441711379192, -2.19267975444489