ProjNet4GeoAPI icon indicating copy to clipboard operation
ProjNet4GeoAPI copied to clipboard

Projection Mercator_Auxiliary_Sphere is not supported.

Open KubaSzostak opened this issue 4 months ago • 0 comments

It looks like the Web Mercator projection is not available in the ProjectionsRegistry.TypeRegistry dictionary. For example, following code throws "Projection Mercator_Auxiliary_Sphere is not supported." exception.

public static void CheckProjection_Mercator_Auxiliary_Sphere ()
{
    // Shapefile projection created in ArcGISPro
    var projection = "PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]";
    var csFactory = new CoordinateSystemFactory();
    var sourceCs = csFactory.CreateFromWkt(projection);
    var targetCs = GeographicCoordinateSystem.WGS84;
    var targetCsEnvelope = GetWgs84Envelope();

    var transformationFactory = new CoordinateTransformationFactory();
    var transformation = transformationFactory.CreateFromCoordinateSystems(sourceCs, targetCs); // System.NotSupportedException : Projection Mercator_Auxiliary_Sphere is not supported.

    var sourceCoords = new double[] { 2063341, 7268244 };
    var tergetCoords = transformation.MathTransform.Transform(sourceCoords);
}

Is there a way to support the use of Mercator_Auxiliary_Sphere projection within ProjNet4GeoAPI library? If so, any guidance on implementation would be greatly appreciated.

KubaSzostak avatar Sep 25 '24 19:09 KubaSzostak