<?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: Initialize a CIMMapDocument same way as a CIMLayerDocument in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414547#M11414</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&amp;nbsp;Not quite, map.GetDefinition() only returns the CIMMap. But sometimes I need the full mapx (CIMMapDocument) definition.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Apr 2024 05:15:31 GMT</pubDate>
    <dc:creator>marco_vertigis</dc:creator>
    <dc:date>2024-04-24T05:15:31Z</dc:date>
    <item>
      <title>Initialize a CIMMapDocument same way as a CIMLayerDocument</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414056#M11407</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;Today I had to extract the binary references of a specific layer and to my surpirse it worked like a charm with the following code snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var binaryReferences = new List&amp;lt;CIMBinaryReference&amp;gt;();

// fetch binary references which are needed in order to properly display graphic layers
var graphicsLayers = map.GetLayersAsFlattenedList().OfType&amp;lt;GraphicsLayer&amp;gt;();
foreach (var graphicLayer in graphicsLayers)
{
	var layerDoc = new LayerDocument(graphicLayer);
	var cimLayerDoc = layerDoc.GetCIMLayerDocument();

	var elementStorageList = cimLayerDoc.BinaryReferences.Where(br =&amp;gt; br.Object is CIMElementStorage);
	binaryReferences.AddRange(elementStorageList);
}&lt;/LI-CODE&gt;&lt;P&gt;At another point I have to do this for a whole map, but unfortunately the only way to get the binary references of a map is to save it to a .mapx file, read and parse it as a json, which has a horrible performance if the map gets huge. Is there a way to get the CIMLayerDocument somehow in memory like I did it with the layer? There is also no class named 'MapDocument' in the public API.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;map.SaveAsFile("C:\data\map.mapx");
var json = File.ReadAllText("C:\data\map.mapx");
var doc = CIMLayoutDocument.FromJson(json);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 11:51:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414056#M11407</guid>
      <dc:creator>marco_vertigis</dc:creator>
      <dc:date>2024-04-23T11:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize a CIMMapDocument same way as a CIMLayerDocument</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414304#M11410</link>
      <description>&lt;P&gt;is something like map.GetDefinition().ToJson() good enough?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 17:53:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414304#M11410</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2024-04-23T17:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Initialize a CIMMapDocument same way as a CIMLayerDocument</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414547#M11414</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&amp;nbsp;Not quite, map.GetDefinition() only returns the CIMMap. But sometimes I need the full mapx (CIMMapDocument) definition.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 05:15:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/initialize-a-cimmapdocument-same-way-as-a/m-p/1414547#M11414</guid>
      <dc:creator>marco_vertigis</dc:creator>
      <dc:date>2024-04-24T05:15:31Z</dc:date>
    </item>
  </channel>
</rss>

