<?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: Save mapx file using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1336897#M68943</link>
    <description>&lt;P&gt;That's very odd. I think you should contact support about that.&lt;/P&gt;&lt;P&gt;I could not reproduce it. When I open the MapX-file with Visual Studio Code, I see this in the json:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"dataConnection" : {
"type" : "CIMStandardDataConnection",
"workspaceConnectionString" : "DATABASE=X:\\GIS\\Projecten\\3D\\GemaalWestland\\FGDB\\Data.gdb",
"workspaceFactory" : "FileGDB",
"dataset" : "GemaalWestland",
"datasetType" : "esriDTFeatureClass"
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Oct 2023 13:09:18 GMT</pubDate>
    <dc:creator>LaurensKusse_hhdelfland</dc:creator>
    <dc:date>2023-10-11T13:09:18Z</dc:date>
    <item>
      <title>Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571898#M44845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking to save some but not all of my&amp;nbsp;&amp;nbsp;Maps in an ArcGIS Pro document as templates. I know I can save the layers out using python but can't find a way to save the "mapx" file using python. I am saving these pieces tp put them into source control.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2019 15:02:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571898#M44845</guid>
      <dc:creator>JohnSawicki1</dc:creator>
      <dc:date>2019-09-20T15:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571899#M44846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you say ArcGIS Pro Documents are you referring to an ArcGIS Pro project file (.aprx) that contains multiple maps?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I'm pretty sure you are talking about .aprx files because I see where you can export the maps as a .mapx file in ArcGIS Pro. However I have not been able to find any way to save a mapx in arcpy. I took a look at the arcpy Mapping Module which was designed to access the information inside of a .aprx file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/introduction-to-arcpy-mp.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/introduction-to-arcpy-mp.htm"&gt;Introduction to arcpy.mp—ArcPy | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also looked in the Map Class for the Mapping Module:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm"&gt;Map—ArcPy | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saw no where in the documentation about saving or exporting as a .mapx. I Also tried to see if saveACopy() would work and it did not. Maybe someone else has more insight?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2019 16:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571899#M44846</guid>
      <dc:creator>Jeremy_Moore</dc:creator>
      <dc:date>2019-09-20T16:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571900#M44847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for figuring out what I meant. I also tried saveACopy on a map but no luck. Seems silly that you can save a map "mapx" externally using from the user interface but there appears to be no way to do so in python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2019 21:34:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571900#M44847</guid>
      <dc:creator>JohnSawicki1</dc:creator>
      <dc:date>2019-09-20T21:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571901#M44848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if this will work and can't test&lt;STRONG&gt;*&lt;/STRONG&gt;, but you could try getting the CIM&amp;nbsp;definition (&amp;gt;= ArcGIS 2.4) from the map and&amp;nbsp;then use json.dump / json.dumps to write the .mapx file manually.&lt;/P&gt;&lt;P&gt;* &lt;SPAN style="font-size: 11px;"&gt;corporate IT moves slooowly and we're still on 2.3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; json

aprx_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"path\\to\\your.aprx"&lt;/SPAN&gt;
mapx_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"path\\to\\{}.mapx"&lt;/SPAN&gt;

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;aprx_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; map &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Map: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    map_def &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getDefinition&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# &amp;lt;-- Get the CIM definition&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mapx_path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'w'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; map_file&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
         map_file&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;write&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dumps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;map_def&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;From the documentation -&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/python-cim-access.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/python-cim-access.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Python CIM access—ArcPy | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;H4 id="toc-hId-1343944681"&gt;&lt;SPAN style="font-size: 22px;"&gt;Python CIM access&lt;/SPAN&gt;&lt;/H4&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;The&amp;nbsp;arcpy.mp&amp;nbsp;module ...&amp;nbsp;does not provide access to all properties, settings, and capabilities available in&amp;nbsp;ArcGIS Pro. One reason is to keep the API streamlined, simple, and manageable. Another reason is that&amp;nbsp;ArcGIS Pro&amp;nbsp;is being developed at such a rapid pace that the APIs can't keep up. It may take a release or more before you have access through the managed APIs. Starting with&amp;nbsp;ArcGIS Pro&amp;nbsp;2.4, Python developers will have fine-grained access to the Cartographic Information Model (CIM) and can access many more settings, properties, and capabilities that are persisted in a project or document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;H4 id="toc-hId--1208212280"&gt;&lt;SPAN style="font-size: 22px;"&gt;What is the CIM&lt;/SPAN&gt;&lt;/H4&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;The CIM is the Esri Cartographic Information Model. It is a map content specification used to document how information that describes various project components is persisted when saved, read, referenced, or opened. The specification is represented as JSON and is used for maps, scenes, layouts, layers, symbols, and styles in ArcGIS applications and APIs.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:37:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571901#M44848</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-12T00:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571902#M44849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArcPy has never been a complete SDK for ArcGIS Desktop.&amp;nbsp; If saving *.mapx files is important, log an enhancement request with Esri Support and submit an &lt;A href="https://community.esri.com/space/2167"&gt;ArcGIS Ideas&lt;/A&gt;‌.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Sep 2019 15:36:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571902#M44849</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-09-21T15:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571903#M44850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/184569"&gt;John Sawicki&lt;/A&gt;‌ did you try this? I'm interested to see if it actually worked or not since I can't test.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Sep 2019 08:06:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571903#M44850</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2019-09-28T08:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571904#M44851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't seem to make it work ... This line&lt;/P&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; font-size: 12.0pt;"&gt;map_file.&lt;SPAN style="color: #a7ec21;"&gt;write&lt;/SPAN&gt;(json.&lt;SPAN style="color: #a7ec21;"&gt;dumps&lt;/SPAN&gt;(map_def))&lt;/PRE&gt;&lt;P&gt;Give me this error:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;TypeError: Object of type 'CIMMap' is not JSON serializable&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have tried a few different ways to output the object but so far no luck ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2019 17:16:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571904#M44851</guid>
      <dc:creator>JohnSawicki1</dc:creator>
      <dc:date>2019-09-30T17:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571905#M44852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;map.getDefinition doesn't return JSON or an object that can be directly serialized to JSON, hence the error.&amp;nbsp; The function returns a CIMMap object that you will have to serialize by hand (not by hand by hand, but write your own function to do it).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2019 19:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571905#M44852</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-09-30T19:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571906#M44853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey John. Did you ever solve this? I addressed a similar JSON serializable error with the following code:&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;arcpy&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;json&amp;nbsp;aprx_path&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"path&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;your.aprx"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;mapx_path&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"path&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;{}&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;.mapx"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;aprx&amp;nbsp;=&amp;nbsp;arcpy.mp.ArcGISProject(aprx_path)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;map&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;aprx.listMaps():&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #dcdcaa;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Map:&amp;nbsp;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;+&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;map&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.name)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;map_def&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;map&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.getDefinition()&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;&amp;lt;--&amp;nbsp;Get&amp;nbsp;the&amp;nbsp;CIM&amp;nbsp;definition&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;with&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;open&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(mapx_path.format(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;map&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.name),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'w'&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;map_file:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;json_mapx_data&amp;nbsp;=&amp;nbsp;json.load(map_file)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;&amp;lt;--&amp;nbsp;Needed&amp;nbsp;serialize and l&lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;oad&amp;nbsp;mapx&amp;nbsp;as&amp;nbsp;JSON&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;json_mapx_data&amp;nbsp;.write(json.dumps(map_def))&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2020 13:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571906#M44853</guid>
      <dc:creator>KimSundeen2</dc:creator>
      <dc:date>2020-09-25T13:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571907#M44854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kim &lt;/P&gt;&lt;P&gt;Thanks ! I will give it a try! I also found this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE class=""&gt;&lt;STRONG&gt;exportToMAPX (out_mapx)&lt;/STRONG&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;TABLE&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TD class=""&gt;Parameter&lt;/TD&gt;&lt;TD class=""&gt;Explanation&lt;/TD&gt;&lt;TD class=""&gt;Data Type&lt;/TD&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;out_mapx&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;A string used to save a &lt;SPAN class=""&gt;Map&lt;/SPAN&gt; to a map file (&lt;SPAN class=""&gt;.mapx&lt;/SPAN&gt;).&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;String&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;This method is useful if you want to save a map to a map file that can be imported later into a project using the &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/arcgisproject-class.htm"&gt;&lt;SPAN class=""&gt;ArcGISProject&lt;/SPAN&gt;&lt;/A&gt; &lt;SPAN class=""&gt;importDocument&lt;/SPAN&gt; method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm"&gt;Map—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it is new but I am stuck on a old version of pro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2020 11:48:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/571907#M44854</guid>
      <dc:creator>JohnSawicki1</dc:creator>
      <dc:date>2020-10-06T11:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1041349#M60588</link>
      <description>&lt;P data-unlink="true"&gt;I am using ArcGIS Pro v2.5.1 and am unable to export a 'mapx' file form the console. When calling the method as described under the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/map-class.htm" target="_self"&gt;help documentation for 'Map'&lt;/A&gt;&amp;nbsp; with the line:&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;aprx = arcpy.mp.ArcGIS Project('CURRENT')&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;m = aprx.activeMap&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;m.exportToMAPX('Template.mapx')&lt;/STRONG&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;I receive the following error:&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;STRONG&gt;Traceback (most recent call last):&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "&amp;lt;string&amp;gt;", line 3, in &amp;lt;module&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;AttributeError: 'Map' object has no attribute 'exportToMAPX'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Any advice or redirection to resources would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 04:45:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1041349#M60588</guid>
      <dc:creator>Yuriko</dc:creator>
      <dc:date>2021-03-28T04:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1041970#M60598</link>
      <description>&lt;P&gt;Similarly, I receive this error when attempting to export a layout to a PAGX file.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;AttributeError&lt;/SPAN&gt;: 'Layout' object has no attribute 'exportToPAGX'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 15:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1041970#M60598</guid>
      <dc:creator>Yuriko</dc:creator>
      <dc:date>2021-03-30T15:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1099834#M62496</link>
      <description>&lt;P&gt;I'm also getting "&lt;SPAN&gt;'Layout' object has no attribute 'exportToPAGX'"&lt;BR /&gt;&lt;BR /&gt;Was there any resolution to this?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Paul&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 12:05:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1099834#M62496</guid>
      <dc:creator>PaulCleverleyArup</dc:creator>
      <dc:date>2021-09-20T12:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1273718#M67311</link>
      <description>&lt;P&gt;This worked for me (ArcGIS Pro 2.9.5):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
aprx = 'c:\\temp\\project.aprx'
folder = 'c:\\temp\\export'
p = arcpy.mp.ArcGISProject(aprx)
for m in p.listMaps():
    #export mapx file
    mapx_path = f'{folder}\\{m.name}.mapx'
    m.exportToMAPX(mapx_path)

for m in p.listLayouts():
    #export pagx file
    pagx_path = f'{folder}\\{m.name}.pagx'
    m.exportToPAGX(pagx_path)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Mar 2023 17:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1273718#M67311</guid>
      <dc:creator>LaurensKusse_hhdelfland</dc:creator>
      <dc:date>2023-03-30T17:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1336692#M68938</link>
      <description>&lt;P&gt;This worked for me in the sense that I got a .mapx file, but the data sources for all the layers is not corrrect...they are all basically missing the name of the geodatabase in their source path. For example:&lt;/P&gt;&lt;P&gt;Name of source geodatabase: GEODATABSE.gdb&lt;/P&gt;&lt;P&gt;Correct path to source: PATH\GEODATABASE.gdb&lt;/P&gt;&lt;P&gt;Exported .mapx path to source: PATH\.gdb&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1336692#M68938</guid>
      <dc:creator>MatthewMassey</dc:creator>
      <dc:date>2023-10-10T19:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Save mapx file using python</title>
      <link>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1336897#M68943</link>
      <description>&lt;P&gt;That's very odd. I think you should contact support about that.&lt;/P&gt;&lt;P&gt;I could not reproduce it. When I open the MapX-file with Visual Studio Code, I see this in the json:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"dataConnection" : {
"type" : "CIMStandardDataConnection",
"workspaceConnectionString" : "DATABASE=X:\\GIS\\Projecten\\3D\\GemaalWestland\\FGDB\\Data.gdb",
"workspaceFactory" : "FileGDB",
"dataset" : "GemaalWestland",
"datasetType" : "esriDTFeatureClass"
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 13:09:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/save-mapx-file-using-python/m-p/1336897#M68943</guid>
      <dc:creator>LaurensKusse_hhdelfland</dc:creator>
      <dc:date>2023-10-11T13:09:18Z</dc:date>
    </item>
  </channel>
</rss>

