<?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: Add VTPK To Map via 'arcpy' in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027596#M37519</link>
    <description>&lt;P&gt;Thank you for responding.&amp;nbsp; After playing with the code some more, this ended up working for me:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os

outputLocation = r"C:\TEMP"

aprx = arcpy.mp.ArcGISProject(outputLocation + "/VTPK.aprx")

m = aprx.listMaps("VTPK")[0]

basemap = m.listLayers("Basemap")[0]

for filename in os.listdir(outputLocation):
    if filename.endswith(".vtpk"):
        lyr = m.addDataFromPath(outputLocation + "/" + filename)
        m.addLayerToGroup(basemap, lyr)
        aprx.save()
        continue
    else:
        continue&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 14:46:11 GMT</pubDate>
    <dc:creator>WilliamCraft</dc:creator>
    <dc:date>2021-02-17T14:46:11Z</dc:date>
    <item>
      <title>Add VTPK To Map via 'arcpy'</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027375#M37486</link>
      <description>&lt;P&gt;Does anyone know how to add a vector tile package (VTPK) to a map using 'arcpy'?&amp;nbsp; I have tried a variety of different syntaxes but my Python code always errors out whether I use the 'addLayer' method or 'addDataFromPath' method.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have about 500+ VTPK files that I need to 'merge' together and what I'm thinking of doing is creating a mobile map package (MMPK) once I can get them added to a map in an automated way.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 22:42:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027375#M37486</guid>
      <dc:creator>WilliamCraft</dc:creator>
      <dc:date>2021-02-16T22:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Add VTPK To Map via 'arcpy'</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027389#M37491</link>
      <description>&lt;P&gt;It helps to provide both code and errors.&amp;nbsp; I thought I had used addDataFromPath with VTPK in the past, so I tested it again and it works fine for me.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 23:07:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027389#M37491</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-02-16T23:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Add VTPK To Map via 'arcpy'</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027596#M37519</link>
      <description>&lt;P&gt;Thank you for responding.&amp;nbsp; After playing with the code some more, this ended up working for me:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os

outputLocation = r"C:\TEMP"

aprx = arcpy.mp.ArcGISProject(outputLocation + "/VTPK.aprx")

m = aprx.listMaps("VTPK")[0]

basemap = m.listLayers("Basemap")[0]

for filename in os.listdir(outputLocation):
    if filename.endswith(".vtpk"):
        lyr = m.addDataFromPath(outputLocation + "/" + filename)
        m.addLayerToGroup(basemap, lyr)
        aprx.save()
        continue
    else:
        continue&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 14:46:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/add-vtpk-to-map-via-arcpy/m-p/1027596#M37519</guid>
      <dc:creator>WilliamCraft</dc:creator>
      <dc:date>2021-02-17T14:46:11Z</dc:date>
    </item>
  </channel>
</rss>

