I'm trying to reproject some coordinates from EPSG:27700 to WGS84. I can do this fine in JS using the proj4 port, but I'm getting different results using DotSpatial.

Here is my .NET code:

var wgs84 = KnownCoordinateSystems.Geographic.World.WGS1984;

var osgb1936 = ProjectionInfo.FromProj4String("+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs");

var reproject = new Func<Point,Point>(input =>
    var arr = new double[] { input.Coordinate.X, input.Y};
    Reproject.ReprojectPoints(arr, null, osgb1936, wgs84, 0, 1);
    return new Point()
        X = arr[0],
        Y = arr[1]

var r = reproject(new Point(161887.0, 1030889.5));

My JS code is:

var osgb1936 = proj4.defs("EPSG:27700", "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs");

var result = proj4('EPSG:27700', 'WGS84', [ 161887.0, 1030889.5 ]);

In JS I'm getting the result [-6.1597047213905, 59.098069153809384] which I believe is correct, but in .NET/DotSpatial I'm getting the result [-162.1702802817330000 -41.6926543605886000].

What am I doing wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.