-2

I need to convert UTM to DMS. For example: x 6518585.31 y 13343143.32 -> degrees minutes seconds.

People refer to this library esri.arcgis.defensesolutions.dll, but I can't find where to download it.

Gary Sheppard
  • 4,764
  • 3
  • 25
  • 35
ILya Kuzmin
  • 85
  • 1
  • 1
  • 9

3 Answers3

2

Try the ArcGIS Runtime SDK for .NET. You can download and use it at no cost for coordinate conversion. Sample code is available, but here's the relevant code for what you need to do. You can use http://spatialreference.org/ref/ to find the WKID for your UTM zone; I'm using 32642, which is the WKID for UTM zone 42N based on WGS84.

var utmSpatialReferenceWkid = 32642;//UTM zone 42N based on WGS84
var pointUtm = new MapPoint(6518585.31, 13343143.32, utmSpatialReferenceWkid);
var pointLonLat = GeometryEngine.Project(pointUtm, SpatialReference.Wgs84);
var longitude = pointLonLat.X;
var latitude = pointLonLat.Y;

The defensesolutions DLL you mentioned is older technology, and you need an ArcGIS Desktop or Engine license to use it, which incurs a cost. Use ArcGIS Runtime instead.

Gary Sheppard
  • 4,764
  • 3
  • 25
  • 35
  • 1
    I joined the project Esri.ArcGISRuntime. Error: The type or namespace name 'Esri' could not be found (are you missing a using directive or an assembly reference?) – ILya Kuzmin Jun 08 '15 at 04:46
  • The project uses the library ESRI.ArcGis.*** version 10.0.0.0 – ILya Kuzmin Jun 08 '15 at 07:45
0

enter image description here enter image description here

coordinate system "Meters" to "Degrees Minutes Seconds"

            ISpatialReferenceFactory srEnv = new SpatialReferenceEnvironmentClass();
            var wgsIn = srEnv.CreateESRISpatialReferenceFromPRJFile(@"C:\111.prj");
            var wgsOut = srEnv.CreateESRISpatialReferenceFromPRJFile(@"C:\222.prj");

            var point = new PointClass();
            point.PutCoords(3304534.9530999996, 6859385.3066000007);
            point.Project(wgsIn);

            var dmsCoord = new DMSCoordinate
            {
                Precision = esriCoordinatePrecision.esriCPOneMeter,
                InputSpatialReference = wgsIn,
                OutputSpatialReference = wgsOut,
                Point = point
            };

            var dsd = dmsCoord.String;

dmsCoord.String Returns incorrect coordinates

ILya Kuzmin
  • 85
  • 1
  • 1
  • 9
0

You can use CoordinateSharp for exactly this.

Example

 UniversalTransverseMercator utm = new UniversalTransverseMercator("T", 32, 233434, 234234);
 Coordinate c = UniversalTransverseMercator.ConvertUTMtoLatLong(utm);
 Console.WriteLine(c); //Outputs DMS formatted coordinate by default.

You can also access individual lat/long properties within the Coordinate object.

Tronald
  • 1,520
  • 1
  • 13
  • 31