Mar 7, 2011 at 3:30 PM


I am trying to convert from EPSG: 25832 ( UTM zone 32N) To Googlemaps Lat/Long which I believe is WGS84?

Here is what I have come up with so far:

The WKT I got from: http://spatialreference.org/ref/epsg/25832/


 	string wktFrom = "GEOGCS[\"ETRS89\",DATUM[\"European_Terrestrial_Reference_System_1989\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6258\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4258\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],AUTHORITY[\"EPSG\",\"25832\"],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]";
            ICoordinateSystem csFrom = CoordinateSystemWktReader.Parse(wktFrom) as ICoordinateSystem;
            GeographicCoordinateSystem csWgs84 = GeographicCoordinateSystem.WGS84;
            CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();

            ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(csFrom, csWgs84);
            double[] fromPoint = new double[] { 563097, 269, 6194521, 937 };
            double[] toPoint = trans.MathTransform.Transform(fromPoint);

The result thou, is not correct, -122.99999999996504 , -88.9999999999934 which should have been Lat: 55.8920212295552 Long: 10.008904232448355

I am fairly new to this are, so any help would be very appreciated.


Patrick Moog


Mar 8, 2011 at 1:02 PM



double[] fromPoint = new double[] { 563097, 269, 6194521, 937 }; is of course:
double[] fromPoint = new double[] { 563097.269, 6194521.937 };

still not giving the correct answer thou.
Mar 13, 2011 at 9:27 AM



WGS84 is not Google, the unofficial EPSG code for google is 900913 (see the resemblance?) and the WKT for that is 


 public const string EPSG_900913_WKT = @"PROJCS[""WGS84 / Simple Mercator"", GEOGCS[""WGS 84"",DATUM[""WGS_1984"", SPHEROID[""WGS_1984"", 6378137.0, 298.257223563]], PRIMEM[""Greenwich"", 0.0], UNIT[""degree"", 0.017453292519943295], AXIS[""Longitude"", EAST], AXIS[""Latitude"", NORTH]],PROJECTION[""Mercator_1SP_Google""], PARAMETER[""latitude_of_origin"", 0.0], PARAMETER[""central_meridian"", 0.0], PARAMETER[""scale_factor"", 1.0], PARAMETER[""false_easting"", 0.0], PARAMETER[""false_northing"", 0.0], UNIT[""m"", 1.0], AXIS[""x"", EAST],AXIS[""y"", NORTH], AUTHORITY[""EPSG"",""900913""]]";


But that is not going to help you because 900913 is not supported. I was just trying to transform between WGS84 (EPSG:4326) and Google but I get an error saying that "System.NotSupportedException: Projection Oblique Stereographic is not supported." 

I get a similar error when I try to convert between 28992 (Dutch CS) and 4326 so I am beginning to think that ProjNET is not going to be useful in this respect unless I dig deep and start adding the unsupported coordinate systems.

Of course if someone else knows a reason why 900913 (possibly the single most useful CS at the moment) is not supported I'd appreciate hearing from you.


Mar 19, 2011 at 8:58 PM

The Google Maps API does use geographic coordinates relative to the WGS84 datum. So, if you're trying to create vector shapes on the map - pushpins, polylines and the like, you need WGS84 lat/long coordinates.

naskew's comments relate to the projected coordinate system used to display that data, which is a Mercator projection relative to a perfect sphere. For a time, the mapping community used the "unofficial" code 900913 to refer to this projection, but it's had an official EPSG code for several years now - 3857. This is the reference system you'll need to use if you want to create raster tile images to overlay directly on the map, rather than using the Google API. This is supported by Proj.NET - you just need to supply the appropriate WKT.

As for your WGS84 conversion, from the magnitude of the error (and from your subsequent comment), I'd guess that your input coordinates are not being supplied correctly - can you check the use of commas and periods as decimal separators in the culture of your application, and add a debug step to make sure that the values that you think you're providing to fromPoint[] really are as you expect them to be?