ratillo89
ratillo89

Reputation: 53

Convert ArcGIS UTM to WGS84

I need convert UTM coordinates (EPSG:23030,Datum ED50,30N,Ellips Hayford 1924) to WGS84 (For rendering on Google). I'm trying with ArcGIS library but I don't get the expected result. This is my code (C#):

SpatialReference wgs84 = SpatialReference.Create(4326);
            MapPoint mp = ConvertCoordinate.FromUtm(string.Format("{0} {1} {2}", "30N", X, Y), wgs84, UtmConversionMode.None);

I think the problem is I don't specificy sourece Datum.

Upvotes: 0

Views: 974

Answers (1)

ratillo89
ratillo89

Reputation: 53

I solved my problem. C# code:

public static void UTMToLatLongDSP(double X, double Y, out double latitude, out double longitude)
{
    double[] xy = new double[] { X, Y };

    MapPoint ptUTMED50 = new MapPoint(X, Y, new SpatialReference(23030));
    SpatialReference srTrans = new SpatialReference(4326);
    MapPoint ptWGS84 = (MapPoint)GeometryEngine.Project(ptUTMED50, srTrans);

    latitude = ptWGS84.Y;
    longitude = ptWGS84.X;
}

Upvotes: 1

Related Questions