<?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: convert mxd to aprx problem in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1616030#M74209</link>
    <description>&lt;P&gt;yes, it's there. Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 19 May 2025 14:53:02 GMT</pubDate>
    <dc:creator>JinZ</dc:creator>
    <dc:date>2025-05-19T14:53:02Z</dc:date>
    <item>
      <title>convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614289#M74178</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to covert mxd to aprx using python scripts. Here is my code. however when open the new aprx, it's empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject(blank_aprx_path)&lt;/P&gt;&lt;P&gt;# Import the MXD document&lt;BR /&gt;aprx.importDocument(file_path)&lt;/P&gt;&lt;P&gt;# Save a copy of the new APRX in the same folder&lt;BR /&gt;aprx.saveACopy(os.path.join(dirpath, f'{mxd_name}.aprx'))&lt;/P&gt;&lt;P&gt;here is the content of mxd.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinZ_0-1747152594369.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/132073iDB4216A70C0676F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinZ_0-1747152594369.png" alt="JinZ_0-1747152594369.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;please help.&lt;/P&gt;&lt;P&gt;Thanks very much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2025 21:32:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614289#M74178</guid>
      <dc:creator>JinZ</dc:creator>
      <dc:date>2025-05-13T21:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614299#M74179</link>
      <description>&lt;P&gt;code examples can be found here&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It appears that some of your data can't be located, hence the red ! marks&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2025 22:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614299#M74179</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-05-13T22:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614446#M74181</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinZ_0-1747211372209.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/132170iEDDF1638DE880F44/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinZ_0-1747211372209.png" alt="JinZ_0-1747211372209.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried to convert this mxd, still the result aprx is empty, the mxd use the sql geo databases, is it the reason?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 08:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614446#M74181</guid>
      <dc:creator>JinZ</dc:creator>
      <dc:date>2025-05-14T08:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614465#M74182</link>
      <description>&lt;P&gt;There is no one-to-one conversion, there are limits&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/get-started/migrate-existing-work.htm" target="_blank"&gt;Migrate existing work—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 09:23:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614465#M74182</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-05-14T09:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614709#M74185</link>
      <description>&lt;P&gt;Here is something I've used in the past. Note, it will create an empty "Map", and you will have a map named whatever you had the Data frame named in the MXD. For example the Map frame in my mxd was named "Layers", so in the new .aprx I have a map named "Layers" and that is where the layers are.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
from pathlib import Path

def convert_mxd_to_aprx(input_folder, template_path, output_folder=None):
    """
    Converts MXD files to APRX format using a specified template APRX.
    """

    input_folder = Path(input_folder).resolve()
    template_path = Path(template_path).resolve()

    # Validate paths
    if not input_folder.exists():
        print(f"Error: Input folder does not exist: {input_folder}")
        return
    if not template_path.exists() or template_path.suffix.lower() != ".aprx":
        print(f"Error: Invalid template APRX file: {template_path}")
        return

    output_folder = Path(output_folder).resolve() if output_folder else input_folder
    output_folder.mkdir(parents=True, exist_ok=True)

    print(f"\nSarting MXD to APRX conversion")
    print(f"put folder: {input_folder}")
    print(f"tput folder: {output_folder}")
    print(f"Tmplate APRX: {template_path}\n")

    for mxd_path in input_folder.rglob("*.mxd"):
        try:
            print(f"Cnverting: {mxd_path.name}")

            aprx = arcpy.mp.ArcGISProject(str(template_path))

            # Track original maps and layouts
            original_map_names = {m.name for m in aprx.listMaps()}
            original_layout_names = {l.name for l in aprx.listLayouts()}

            # Import MXD with layout
            aprx.importDocument(str(mxd_path), include_layout=True)

            # Detect new maps and layouts
            new_maps = [m for m in aprx.listMaps() if m.name not in original_map_names]
            new_layouts = [l for l in aprx.listLayouts() if l.name not in original_layout_names]

            if new_maps:
                imported_map = new_maps[0]
                layer_count = len(imported_map.listLayers())
                print(f"ported map: {imported_map.name} ({layer_count} layers)")
            else:
                print(f"No new map found.")

            if new_layouts:
                imported_layout = new_layouts[0]
                mapframes = imported_layout.listElements("MAPFRAME_ELEMENT")
                print(f"ported layout: {imported_layout.name} ({len(mapframes)} map frame(s))")
            else:
                print(f"No new layout found.")

            # Save the converted APRX
            output_aprx_path = output_folder / mxd_path.with_suffix(".aprx").name
            aprx.saveACopy(str(output_aprx_path))

            if output_aprx_path.exists():
                print(f"Saved: {output_aprx_path}\n")
            else:
                print(f"Failed to save: {output_aprx_path}\n")

        except Exception as e:
            print(f"Error processing {mxd_path.name}: {e}\n")
        finally:
            if 'aprx' in locals():
                del aprx

    print("All conversions complete.\n")

# Example usage
if __name__ == "__main__":
    convert_mxd_to_aprx(
        input_folder=r"C:\Temp\Test",
        template_path=r"C:\Temp\Test\MyNewProject.aprx",
        output_folder=r"C:\Temp\APRX_Output"
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 18:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1614709#M74185</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-05-14T18:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1615902#M74204</link>
      <description>&lt;P&gt;Thanks, just tried and not working for me. The converted aprx is still empty.&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2025 09:10:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1615902#M74204</guid>
      <dc:creator>JinZ</dc:creator>
      <dc:date>2025-05-19T09:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1615910#M74205</link>
      <description>&lt;P&gt;Can you locate the missing data manually by adding it to a new project?&amp;nbsp; If not, then the data location may be the issue.&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2025 09:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1615910#M74205</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-05-19T09:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1615937#M74206</link>
      <description>&lt;P&gt;If I use Acgis Pro , Insert--&amp;gt;ImportMap, select the same mxd, all data loaded.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2025 12:18:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1615937#M74206</guid>
      <dc:creator>JinZ</dc:creator>
      <dc:date>2025-05-19T12:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1616024#M74208</link>
      <description>&lt;P&gt;After you run the script and when you first open the .aprx it will have an empty map. The script converts the arcmap map into a new map. You need check, under Catalog --&amp;gt; Project --&amp;gt; Maps, you should a another map--&amp;gt; this is your new map that was converted from Arcmap to Pro.&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2025 14:40:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1616024#M74208</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-05-19T14:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: convert mxd to aprx problem</title>
      <link>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1616030#M74209</link>
      <description>&lt;P&gt;yes, it's there. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 19 May 2025 14:53:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-mxd-to-aprx-problem/m-p/1616030#M74209</guid>
      <dc:creator>JinZ</dc:creator>
      <dc:date>2025-05-19T14:53:02Z</dc:date>
    </item>
  </channel>
</rss>

