<?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: How do I upload a raster to ArcGIS Enterprise as an image service using arcpy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330610#M68708</link>
    <description>&lt;P&gt;I believe the problem you're facing is&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;CreateImageSDDRaft &lt;/FONT&gt;&lt;SPAN&gt;is meant for publishing to ArcGIS Server. There's a required "connection_file_path" parameter I think you're missing which points to the path of an .ags connection file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To my knowledge, it is possible to publish through Portal using a different workflow that relies on the ArcGIS API for Python:&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/creating-imagery-layers/" target="_blank"&gt;Create Imagery Layers | ArcGIS API for Python&lt;/A&gt;. However, I believe in order to make use of this approach you need to have a portal configured for Raster Analysis.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 14:11:33 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2023-09-20T14:11:33Z</dc:date>
    <item>
      <title>How do I upload a raster to ArcGIS Enterprise as an image service using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330455#M68705</link>
      <description>&lt;P&gt;I'm trying to automate a workflow that we perform in ArcGIS Pro. The workflow is taking some rasters that are stored in a FGDB and sharing them as an image service via Portal and a federated server.&lt;/P&gt;&lt;P&gt;Here is the documentation on the manual process that works&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/web-image-layer.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/web-image-layer.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The manual steps are&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;In Catalog (not in a map) right click on the raster and choose "share as web layer"&lt;/LI&gt;&lt;LI&gt;In the sharing panel choose the option "Copy all Data"&lt;/LI&gt;&lt;LI&gt;Click Publish&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This results in an image service in Enterprise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I cannot seem to script this workflow. I tried using&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.CreateImageSDDraft&lt;/LI-CODE&gt;&lt;P&gt;But it seems to create a Server-only version of the .sddraft. I can stage the file using arcpy.StageService but cannot upload the resulting .sd file to Portal. I even tried manually uploading the .sd file to Portal and Portal gave me a warning that it was an ArcGIS Server file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from arcgis.gis import GIS

gis = GIS(url="https://url.to.portal/arcgis", username="userid", password="pass", set_active=True, expiration = 60, verify_cert=False)
service =r'Test_Image'
source = r'C:\Temp\Upload\20230721_AirPollutionPackage.gdb\SD_0721_1030_PM25_IDW'
sddraft = r'C:\Temp\Upload\SD_0721_1030_PM25_IDW.sddraft'
sdfinal = r'C:\Temp\Upload\SD_0721_1030_PM25_IDW.sd'

arcpy.CreateImageSDDraft( raster_or_mosaic_layer= source, out_sddraft=sddraft, service_name=service, server_type= 'ARCGIS_SERVER', 
                          copy_data_to_server=  True, folder_name= None, summary= "Test Image Upload", 
                         tags= "las,image service")
try:
    arcpy.StageService_server(in_service_definition_draft= sddraft, out_service_definition= sdfinal, staging_version=5)
    arcpy.UploadServiceDefinition_server(in_sd_file=sdfinal, in_server="My Hosted Services")
    warnings = arcpy.GetMessages(1)
    print(warnings)
except Exception as ecp:
    print(str(ecp))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 23:53:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330455#M68705</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2023-09-19T23:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I upload a raster to ArcGIS Enterprise as an image service using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330610#M68708</link>
      <description>&lt;P&gt;I believe the problem you're facing is&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;CreateImageSDDRaft &lt;/FONT&gt;&lt;SPAN&gt;is meant for publishing to ArcGIS Server. There's a required "connection_file_path" parameter I think you're missing which points to the path of an .ags connection file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To my knowledge, it is possible to publish through Portal using a different workflow that relies on the ArcGIS API for Python:&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/creating-imagery-layers/" target="_blank"&gt;Create Imagery Layers | ArcGIS API for Python&lt;/A&gt;. However, I believe in order to make use of this approach you need to have a portal configured for Raster Analysis.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 14:11:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330610#M68708</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-09-20T14:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I upload a raster to ArcGIS Enterprise as an image service using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330826#M68710</link>
      <description>&lt;P&gt;Thanks for the response &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;. Unfortunately, we do not have a Raster Analysis deployment. We only have an ArcGIS Server Advanced and a relational datastore.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So is there no way to replicate the Share Web Image Layer tool in Arcpy? It seems odd since it can be accomplished via Pro.&lt;/P&gt;&lt;P&gt;Since we are federated I don't believe I can create or use a publisher arcgis server connection, .ags file.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 20:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330826#M68710</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2023-09-20T20:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I upload a raster to ArcGIS Enterprise as an image service using arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330851#M68713</link>
      <description>&lt;P&gt;I think you can reasonably simulate the same result for your case. Instead of going through Portal you publish directly to Server and copy the data. It seems like you're publishing single raster datasets? That should be fine under your licensing. All you should have to do to is make some minor changes to your &lt;SPAN&gt;CreateImageSDDRaft&amp;nbsp;&lt;/SPAN&gt;function.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 21:23:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-upload-a-raster-to-arcgis-enterprise-as/m-p/1330851#M68713</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-09-20T21:23:00Z</dc:date>
    </item>
  </channel>
</rss>

