I use a piece of code for dynamically loading feature layers. Either before or after the loading, I need to set the Data Frame in Decimal Degrees. Is there such a piece of code that can set / change the Data Frame's setting? Thanks.
Use the IMap.DistanceUnits property
Ken:
Thanks for your hint. Below is the code I have. But I can't QI to Decimal Degree. What's wrong in my code? Thanks.
m_mxDoc = (IMxDocument)app.Document; //m_app.Document;
m_Map = m_mxDoc.FocusMap;
m_activeView = (IActiveView)m_Map;
ISpatialReference spRef = m_Map.SpatialReference;
IProjectedCoordinateSystem pProjectedCoordinateSystem = spRef as IProjectedCoordinateSystem;
ILinearUnit pLinearUnit = pProjectedCoordinateSystem.CoordinateUnit;
I believe you're overthinking it. Try this
m_Map = m_mxDoc.FocusMap;
m_Map.DistanceUnits = esriDecimalDegrees
Ken:
Thanks for your response. I revised my program. But after the feature layers are loaded, the frame still shows feet as the unit. Besides, the returned values (Calculated central X & Y) are still in feet. Any new idea? Thanks.
If the underlying data is in feet then a field calculate will return feet even though the map is displaying in decimal degrees. Also there is a difference between MapUnits and DistanceUnits read the remarks section here.