<?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 Aprx to Web Map Automation in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/aprx-to-web-map-automation/m-p/285411#M22056</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Hello,&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;I am currently automating the creation of maps in ArcGIS Pro through the arcpy Python library, and I was wondering if it was possible to run a script to publish a Web Map to ArcGIS Online using an aprx project using arcpy. I have noticed for ArcMap, there is a function 'arcpy.MXDToWebMap_server' which could do this for me (as far as I understand), but I have been having trouble doing this through ArcGIS Pro. I have looked at several sources including the CreateWebLayerSDDraft, but the results in ArcGIS Online were hosted as a Feature Layer instead of a Web Map and was obtaining only my feature layer and not my geodatabase raster. I have tried something like this:&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;aprx = arcpy.mp.ArcGISProject('aprx file path')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;m = aprx.listMaps()[0]&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;arcpy.mp.CreateWebLayerSDDraft(m,'sddraft location','projectName','MY_HOSTED_SERVICES')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;arcpy.StageService_server('sddraft location', 'sd location')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;arcpy.UploadServiceDefinition_server('sd location', 'My Hosted Services')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;This may be somewhat of a duplicate of:&lt;A _jive_internal="true" data-containerid="2145" data-containertype="14" data-objectid="223106" data-objecttype="1" href="https://community.esri.com/thread/223106-fully-automate-manual-arcgis-pro-share-web-map-workflow" style="color: #287433; background-color: transparent; border: 0px; font-weight: inherit; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Fully automate manual ArcGIS Pro [Share -&amp;gt; Web Map] workflow&lt;/A&gt;, but I am not understanding how to upload my aprx to the 'arcgis.mapping.WebMap' component referenced in the answer either.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Thanks for any help you can provide me. (Sorry if this was posted twice, I deleted the old one after accidentally marking it as assumed resolved)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Apr 2020 21:10:55 GMT</pubDate>
    <dc:creator>AdamCurtis</dc:creator>
    <dc:date>2020-04-04T21:10:55Z</dc:date>
    <item>
      <title>Aprx to Web Map Automation</title>
      <link>https://community.esri.com/t5/python-questions/aprx-to-web-map-automation/m-p/285411#M22056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Hello,&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;I am currently automating the creation of maps in ArcGIS Pro through the arcpy Python library, and I was wondering if it was possible to run a script to publish a Web Map to ArcGIS Online using an aprx project using arcpy. I have noticed for ArcMap, there is a function 'arcpy.MXDToWebMap_server' which could do this for me (as far as I understand), but I have been having trouble doing this through ArcGIS Pro. I have looked at several sources including the CreateWebLayerSDDraft, but the results in ArcGIS Online were hosted as a Feature Layer instead of a Web Map and was obtaining only my feature layer and not my geodatabase raster. I have tried something like this:&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;aprx = arcpy.mp.ArcGISProject('aprx file path')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;m = aprx.listMaps()[0]&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;arcpy.mp.CreateWebLayerSDDraft(m,'sddraft location','projectName','MY_HOSTED_SERVICES')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;arcpy.StageService_server('sddraft location', 'sd location')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;arcpy.UploadServiceDefinition_server('sd location', 'My Hosted Services')&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;This may be somewhat of a duplicate of:&lt;A _jive_internal="true" data-containerid="2145" data-containertype="14" data-objectid="223106" data-objecttype="1" href="https://community.esri.com/thread/223106-fully-automate-manual-arcgis-pro-share-web-map-workflow" style="color: #287433; background-color: transparent; border: 0px; font-weight: inherit; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Fully automate manual ArcGIS Pro [Share -&amp;gt; Web Map] workflow&lt;/A&gt;, but I am not understanding how to upload my aprx to the 'arcgis.mapping.WebMap' component referenced in the answer either.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Thanks for any help you can provide me. (Sorry if this was posted twice, I deleted the old one after accidentally marking it as assumed resolved)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2020 21:10:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/aprx-to-web-map-automation/m-p/285411#M22056</guid>
      <dc:creator>AdamCurtis</dc:creator>
      <dc:date>2020-04-04T21:10:55Z</dc:date>
    </item>
  </channel>
</rss>

