1

today I discovered this library, but after trying to convert coordinates from one to other system find out that there is some calculation error.

I googled possible solutions for this problem, but without success. I found this link and followed instructions but it doesn't work to me.

https://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/

I would like to convert coordinate from this zone: MGI / Balkans zone 6...

to google earth system...

I created this function for testing:

        public static void Check(double  x, double y)
    {
        ICoordinateSystem CoordSystemInput = ProjNet.UnitTests.SRIDReader.GetCSbyID(31276);
        var _testCoordinationSystemInput = CoordinateSystemWktReader.Parse(CoordSystemInput.WKT) as IProjectedCoordinateSystem;

        ICoordinateSystem CoordSystemOutput = ProjNet.UnitTests.SRIDReader.GetCSbyID(32767);
        var _testCoordinationSystemOutput = CoordinateSystemWktReader.Parse(CoordSystemOutput.WKT) as IProjectedCoordinateSystem;

        ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(_testCoordinationSystemInput, _testCoordinationSystemOutput);

        double[] fromPoint = { x, y };
        double[] p1 = trans.MathTransform.Transform(fromPoint);

        string Lat = p1[0].ToString();
        string Lon = p1[1].ToString();

        MessageBox.Show(Lat.ToString() + "," + Lon.ToString());
    }

First one system under number 31276 is:

PROJCS["MGI / Balkans zone 6",GEOGCS["MGI",DATUM["Militar_Geographische_Institute",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6312"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4312"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",18],PARAMETER["scale_factor",0.9999],PARAMETER["false_easting",6500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","31276"]]

Second one is under number 32767 is:

PROJCS["Popular Visualisation CRS / Mercator",GEOGCS["Popular Visualisation CRS",DATUM["WGS84",SPHEROID["WGS84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7059"]],AUTHORITY["EPSG","6055"]],PRIMEM["Greenwich", 0, AUTHORITY["EPSG", "8901"]],UNIT["degree", 0.0174532925199433, AUTHORITY["EPSG", "9102"]],AXIS["E", EAST], AXIS["N", NORTH], AUTHORITY["EPSG","4055"]],PROJECTION["Mercator"],PARAMETER["semi_minor",6378137],PARAMETER["False_Easting", 0],PARAMETER["False_Northing", 0],PARAMETER["Central_Meridian", 0],PARAMETER["Latitude_of_origin", 0],UNIT["metre", 1, AUTHORITY["EPSG", "9001"]],AXIS["East", EAST], AXIS["North", NORTH],AUTHORITY["EPSG","3785"]]

Here are my testing coordinates and link on correct result:

x = 6503462.895
y = 4922042.835

https://epsg.io/transform#s_srs=3908&t_srs=900913&x=6503462.8950000&y=4922042.8350000

x = 2008028.9823
y = 5534233.6783

But this is what I getting (with mistake):

x = 2008594.2781
y = 5534328.1856
0

Update:

With this example I solved my problem:

https://gist.github.com/erycson/98fe8ab66d168e643621

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.