Re-project Grid in layout

192
0
04-19-2021 01:24 AM
PrashantKirpan
Occasional Contributor

Hi,

I have layout which contains dataframe and gird. I've 2 maps with different projection. I'm parsing this layout programmatically and switching maps. While switching maps I want to re-project grid based on map projection. 

I've manually created projected coordinate system object and assign to map grid but new projection not reflecting in grid's coordinate property. 

Here is my sample code :

 

 MapFrame mf = (MapFrame)item;
 CIMMapFrame cimframe = (CIMMapFrame)item.GetDefinition();
if (cimframe.Grids != null)
 foreach (CIMMapGrid grds in cimframe.Grids) 
 {
  SpatialReference sr = mymap.SpatialReference;                                          
  ProjectedCoordinateSystem pcs = new ProjectedCoordinateSystem()
   {
     ..,
     ..,
     LatestWKID = sr.LatestWkid,     
     ..,
    WKID = sr.Wkid
   };
((ArcGIS.Core.CIM.CIMMeasuredGrid)grds).ProjectedCoordinateSystem = pcs;                                        
}

 

 Any help would be appreciated.

-Prashant

0 Kudos
0 Replies