Convert Coordinate System to EPSG:3857

Aug 13, 2011 at 5:56 AM

Although it seems this is a question that is asked a lot in the discussions, I don't seem to get a clear answer.

The first of my problems is, I have not come to conclusion which is the correct EPSG:3857 WKT code - I have found various versions:

PROJCS["WGS 84 / Pseudo-Mercator",
  GEOGCS["WGS 84",
    DATUM["WGS_1984",
      SPHEROID["WGS 84", 6378137, 298.257223563, AUTHORITY["EPSG","7030"]],
      AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich", 0, AUTHORITY["EPSG","8901"]],
    UNIT["degree", 0.01745329251994328, AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]],
  PROJECTION["Mercator_1SP"],
  PARAMETER["central_meridian",0],
  PARAMETER["scale_factor",1],
  PARAMETER["false_easting",0],
  PARAMETER["false_northing",0],
  UNIT["metre", 1, AUTHORITY["EPSG","9001"]],
  AXIS["X",EAST],
  AXIS["Y",NORTH],
  AUTHORITY["EPSG","3857"]]
  
  
PROJCS["WGS 84 / Pseudo-Mercator",
  GEOGCS["WGS 84",
    DATUM["World Geodetic System 1984",
      SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]],
      AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.017453292519943295],
    AXIS["Geodetic latitude",NORTH],
    AXIS["Geodetic longitude",EAST],
    AUTHORITY["EPSG","4326"]],
  PROJECTION["Popular Visualisation Pseudo Mercator",AUTHORITY["EPSG","1024"]],
  PARAMETER["Latitude of natural origin",0.0],
  PARAMETER["Longitude of natural origin",0.0],
  PARAMETER["False easting",0.0],
  PARAMETER["False northing",0.0],
  UNIT["metre",1.0],
  AXIS["Easting",EAST],
  AXIS["Northing",NORTH],
  AUTHORITY["EPSG","3857"]]

Although 900913, ESRI:102113, ESRI:102100, EPSG:3785 and EPSG:3857 are supposed to be interchangeable, their WKT definitions do not come even close:

PROJCS["Popular Visualisation CRS / Mercator",
  GEOGCS["Popular Visualisation CRS",
    DATUM["Popular_Visualisation_Datum",
      SPHEROID["Popular Visualisation Sphere",6378137,0,AUTHORITY["EPSG","7059"]],
      TOWGS84[0,0,0,0,0,0,0],
      AUTHORITY["EPSG","6055"]],
    PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4055"]],
  PROJECTION["Mercator_1SP"],
  PARAMETER["central_meridian",0],
  PARAMETER["scale_factor",1],
  PARAMETER["false_easting",0],
  PARAMETER["false_northing",0],
  UNIT["metre",1,AUTHORITY["EPSG","9001"]],
  AXIS["X",EAST],
  AXIS["Y",NORTH],
  AUTHORITY["EPSG","3785"]]
  
  
  PROJCS["Popular Visualisation CRS / Mercator",
  GEOGCS["Popular Visualisation CRS",
    DATUM["Popular Visualisation Datum",
      SPHEROID["Popular Visualisation Sphere", 6378137, 0, AUTHORITY["EPSG",7059]],
      TOWGS84[0, 0, 0, 0, 0, 0, 0],
      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["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]]

My "dream" code would be something like:

        public static ICoordinateTransformation TransformationToEPSG3857(ICoordinateSystem sourceCoordinateSystem)
        {
            string EPSG_3857 = "PROJCS[\"WGS 84 / Pseudo-Mercator\",GEOGCS[\"WGS 84\",DATUM[\"World Geodetic System 1984\",SPHEROID[\"WGS 84\", 6378137.0, 298.257223563, AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\", 0.017453292519943295],AXIS[\"Geodetic latitude\", NORTH],AXIS[\"Geodetic longitude\", EAST],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Popular Visualisation Pseudo Mercator\"],PARAMETER[\"Latitude of natural origin\", 0.0],PARAMETER[\"Longitude of natural origin\", 0.0],PARAMETER[\"False easting\", 0.0],PARAMETER[\"False northing\", 0.0],UNIT[\"metre\", 1.0],AXIS[\"Easting\", EAST],AXIS[\"Northing\", NORTH],AUTHORITY[\"EPSG\",\"3857\"]]";

            CoordinateSystemFactory csFactory = new CoordinateSystemFactory();

            ICoordinateSystem sourceGeographicCoordinateSystem = csFactory.CreateFromWkt(sourceCoordinateSystem.WKT);
            ICoordinateSystem targetProjectedCoordinateSystem = csFactory.CreateFromWkt(EPSG_3857);

            CoordinateTransformationFactory ctFactory = new CoordinateTransformationFactory();
            return ctFactory.CreateFromCoordinateSystems(sourceGeographicCoordinateSystem, targetProjectedCoordinateSystem);
        }

Can someone point me to a reference with the EPSG:3857 WKT that Proj.NET could parse correctly?

Is it possible to use the above code in order to create a transformation, having in mind that I would have the WKT code of the source coordinate system?

 

Thanks in advance,
George J.

Coordinator
Aug 13, 2011 at 11:24 AM

Have you tried with the last projection listed here?

http://projnet.codeplex.com/wikipage?title=CommonWellKnownText&referringTitle=Home