Setting Map Distance Units to Degrees Minutes Seconds

681
1
02-18-2014 01:55 PM
MikeBallard
New Contributor II
I have a button in my Addin that changes the Data Frame display distance units to decimal degrees, which works well:

IMxDocument mxDoc = ArcMap.Document;
ESRI.ArcGIS.Carto.IActiveView activeView = mxDoc.ActiveView;
IPageLayout pageLayout = activeView as IPageLayout;
IMap map = activeView.FocusMap;
map.DistanceUnits = esriUnits.esriDecimalDegrees;

My problem is I would like to have a button that changes the map distance units to Degrees Minutes Seconds. I can do it manually through the Data Frame properties dialog box, but I am searching for a C#/ArcObjects way to do that.
0 Kudos
1 Reply
SachinKanaujia
Occasional Contributor III
You can try using ILatLonFormat2 Interface. This is not a tested code but giving you some directions.

    Dim pLatLonFormat As ILatLonFormat2
    Set pLatLonFormat = New LatLonFormat
    With pLatLonFormat
        .ShowZeroMinutes = True
        .ShowZeroSeconds = True
    End With
   
    Dim pReportUnitFormat2 As IReportUnitFormat2
    Set pReportUnitFormat2 = pMXDoc
    pReportUnitFormat2.CoordinateReadoutUnits = esriDecimalDegrees
    Set pReportUnitFormat2.CoordinateReadoutLatLonFormat = pLatLonFormat

I Hope this helps
0 Kudos