<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MapGrid labels (coordinates) for layout on the right side of the map in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapgrid-labels-coordinates-for-layout-on-the-right/m-p/1090046#M7045</link>
    <description>&lt;P&gt;I use the following steps to solve these types of CIM related configuration problems:&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I use the Pro UI to create a Grid in my Layout's MapFrame to fulfill my requirements.&amp;nbsp; I then create a test add-in with one button and insert the following code snippet into the button's code-behind:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override void OnClick()
	{
	  LayoutView activeLayoutView = LayoutView.Active;
	  if (activeLayoutView == null)
	  {
		MessageBox.Show("No active Layout");
		return;
	  }
	  var mapframe = activeLayoutView.ActiveMapFrame;
	  if (mapframe == null)
	  {
		MessageBox.Show("No active MapFrame");
		return;
	  }
	  QueuedTask.Run(() =&amp;gt;
	  {
		var mapFrameDefinition = mapframe.GetDefinition();
		CIMMapFrame cimMapFrame = mapFrameDefinition as CIMMapFrame;
		System.IO.File.WriteAllText(@"c:\temp\mapgrid.xml", cimMapFrame.ToXml());
	  });
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running the test add-in I select my layout and make my MapFrame the active map frame.&amp;nbsp; After I used my test button I can then open the output file:&amp;nbsp;c:\temp\mapgrid.xml in Visual Studio.&amp;nbsp; Using the output 'CIMMapFrame' structure I use the XML to find and examine the GridLines that were defined by ArcGIS Pro:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1629307519720.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21084i888CA6AE4BD0D6FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1629307519720.png" alt="Wolf_0-1629307519720.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Aug 2021 17:26:56 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-08-18T17:26:56Z</dc:date>
    <item>
      <title>MapGrid labels (coordinates) for layout on the right side of the map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapgrid-labels-coordinates-for-layout-on-the-right/m-p/1089543#M7039</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to display the grid label (coordinates) of a MapFrame on the right side of the map, but can't figure out how to do this. At the moment they are on the left side. I'ld like to do this in my code...&lt;/P&gt;&lt;P&gt;I've found the indices for position on the element:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Grid position indexes. Coordinates on the left side (I want them on the right side)" style="width: 358px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/20971iBB767F672CE00418/image-size/medium?v=v2&amp;amp;px=400" role="button" title="grid_positions.PNG" alt="Grid position indexes. Coordinates on the left side (I want them on the right side)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Grid position indexes. Coordinates on the left side (I want them on the right side)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var gridLabelsNorthSouth = new CIMGridLine
{
	Name = "Labels",
	ElementType = GridElementType.Label,
	GridLineOrientation = GridLineOrientation.NorthSouth,
	Pattern = new CIMGridPattern { Interval = this.printOptions.KoordinatenGitter, Start = 1, Stop = 0, Gap = 0 },
	VisibleIndices = new int[] { 3, 4 }, // &amp;lt;-- This is not working
	FromTick = new CIMExteriorTick
	{
		Length = 0.0694,
		Offset = 0,
		IsVisible = true,
		EdgeAffinity = new int[] { 3, 4 }, // &amp;lt;-- This is not working
		GridEndpoint = new CIMGridEndpoint
		{
			GridLabelTemplate = new CIMSimpleGridLabelTemplate
			{
				// DynamicStringTemplate = $"&amp;lt;dyn type=\"grid\" units=\"{gridUnits}\" decimalPlaces=\"0\" separator=\"True\" showDirections=\"False\" showZeroMinutes=\"False\" showZeroSeconds=\"False\"/&amp;gt;", 
				DynamicStringTemplate = $"&amp;lt;dyn type=\"grid\" decimalPlaces=\"0\" separator=\"True\" showDirections=\"False\" showZeroMinutes=\"False\" showZeroSeconds=\"False\"/&amp;gt;",
				Symbol = (SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8, "Arial", "Regular")).MakeSymbolReference()
			},
			Offset = 0.083,
			Position = 4,  // &amp;lt;-- This is not working
			LineSelection = 7
		}
	},
	ToTick = new CIMExteriorTick
	{
		Length = 0.0694,
		Offset = 0,
		IsVisible = true,
		EdgeAffinity = new int[] { 3, 4 }, // &amp;lt;-- This is not working
		GridEndpoint = new CIMGridEndpoint
		{
			GridLabelTemplate = new CIMSimpleGridLabelTemplate
			{
				DynamicStringTemplate = "", //TODO                               
				Symbol = (SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 0.5, "Arial", "Regular")).MakeSymbolReference()
			},
			Offset = 0.083,
			Position = 4,  // &amp;lt;-- This is not working
			LineSelection = 7
		}
	}
};

var projectedCoordinateSystem = mapframe.Map.SpatialReference.ToCIMSpatialReference() as ProjectedCoordinateSystem;

CIMMapGrid mapGrid = new CIMMeasuredGrid
{
	Name = "GEODAT-Tools_MapGrid",
	GridLines = new CIMGridLine[] { gridLinesEastWest, gridLinesNorthSouth, gridLabelsEastWest, gridLabelsNorthSouth },
	IsVisible = true,
	ProjectedCoordinateSystem = projectedCoordinateSystem,
};

var mapFrameDefinition = mapframe.GetDefinition();
CIMMapFrame cimMapFrame = mapFrameDefinition as CIMMapFrame;
cimMapFrame.Grids = new CIMMapGrid[] { mapGrid };
mapframe.SetDefinition(mapFrameDefinition);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice ?&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 14:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapgrid-labels-coordinates-for-layout-on-the-right/m-p/1089543#M7039</guid>
      <dc:creator>FredB</dc:creator>
      <dc:date>2021-08-17T14:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: MapGrid labels (coordinates) for layout on the right side of the map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapgrid-labels-coordinates-for-layout-on-the-right/m-p/1090046#M7045</link>
      <description>&lt;P&gt;I use the following steps to solve these types of CIM related configuration problems:&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I use the Pro UI to create a Grid in my Layout's MapFrame to fulfill my requirements.&amp;nbsp; I then create a test add-in with one button and insert the following code snippet into the button's code-behind:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override void OnClick()
	{
	  LayoutView activeLayoutView = LayoutView.Active;
	  if (activeLayoutView == null)
	  {
		MessageBox.Show("No active Layout");
		return;
	  }
	  var mapframe = activeLayoutView.ActiveMapFrame;
	  if (mapframe == null)
	  {
		MessageBox.Show("No active MapFrame");
		return;
	  }
	  QueuedTask.Run(() =&amp;gt;
	  {
		var mapFrameDefinition = mapframe.GetDefinition();
		CIMMapFrame cimMapFrame = mapFrameDefinition as CIMMapFrame;
		System.IO.File.WriteAllText(@"c:\temp\mapgrid.xml", cimMapFrame.ToXml());
	  });
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running the test add-in I select my layout and make my MapFrame the active map frame.&amp;nbsp; After I used my test button I can then open the output file:&amp;nbsp;c:\temp\mapgrid.xml in Visual Studio.&amp;nbsp; Using the output 'CIMMapFrame' structure I use the XML to find and examine the GridLines that were defined by ArcGIS Pro:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1629307519720.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21084i888CA6AE4BD0D6FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1629307519720.png" alt="Wolf_0-1629307519720.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 17:26:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapgrid-labels-coordinates-for-layout-on-the-right/m-p/1090046#M7045</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-08-18T17:26:56Z</dc:date>
    </item>
  </channel>
</rss>

