Select to view content in your preferred language

How to change display units

1623
7
10-11-2018 12:36 AM
servicesigu
Occasional Contributor

Hello,

With the sdk, I don't find the way to change, display units when I add a new map to a project.

I can change the name, spatialreference, reference scale ....

        private async void onProjectItemsChanged(ProjectItemsChangedEventArgs obj)

        {
            //if (obj.ProjectItem.GetType()== MapProjectItem)
            if (obj.Action == NotifyCollectionChangedAction.Add)
            {
                if (obj.ProjectItem.GetType().Equals(typeof(MapProjectItem)))
                {
                    MapProjectItem map = (MapProjectItem)obj.ProjectItem;
                    Map mp = map.GetMap();
                    await QueuedTask.Run(() =>
                    {
                        mp.SetName("test");
                        mp.SetSpatialReference(SpatialReferenceBuilder.CreateSpatialReference(3950));
                        mp.SetLabelEngine(LabelEngine.Maplex);
                        mp.SetBasemapLayers(Basemap.None);

                        CIMMap m = mp.GetDefinition();
                       // m.ScaleDisplayFormat
                      
                        m.ReferenceScale = 1000;
                        m.DefaultRotation = 10;
                        m.Description = "Test description";
                        mp.SetDefinition(m);

                    });

            }
            }   
        }

but no way for display units.

Could some help me ?

Thanks 

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

ArcGIS Pro 2.2 API Reference Guide 

vb Public Property DisplayUnits As Unit

c# public Unit DisplayUnits {get; set;}

0 Kudos
servicesigu
Occasional Contributor

Ok, but from wich object, method, is it possible to access to the CIMDimensionStyle ?

Map ?

CIMMap ?

or other ?

0 Kudos
servicesigu
Occasional Contributor

Can you give us a sample code of using the property DisplayUnits with a map in the SDK for ArcGis Pro ?

I don't find the way to access to this property from a map !

0 Kudos
servicesigu
Occasional Contributor

I just want to change the Display Units from "Decimal Degress" to "Meters" via SDK when a new map is added or loaded.

Thanks in advance for your reply.

0 Kudos
UmaHarano
Esri Regular Contributor

Hi

This is currently not supported in the SDK. Support will be added in version 2.6.

Thanks

Uma

0 Kudos
UmaHarano
Esri Regular Contributor

This did not make it in 2.6 release. It has been moved to the 2.7 release.

Thanks

Uma

TheBobScript
Occasional Contributor

Hi Uma,

Did this change make it to 2.7+?  

Also, I have discovered (in 2.8.3) that trying to set the rotation of a map (example from above:  m.DefaultRotation = 10;) in a project does not work.  Changes to the rotation in ArcGIS Pro will reflect correctly in code, but attempts to set a new value will not appear in Pro.

Thanks,

Bob 

0 Kudos