<?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: Working in arctoolbox directly with an image service in ArcGIS Image Server Questions</title>
    <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113654#M15</link>
    <description>&lt;P&gt;Wouldn't it be the same for every image service? Just going through the table and collecting the OBJECTIDs in a list, for example?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Nov 2021 16:02:05 GMT</pubDate>
    <dc:creator>OlgaKoblet</dc:creator>
    <dc:date>2021-11-03T16:02:05Z</dc:date>
    <item>
      <title>Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113552#M6</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need to access a published image service through python and perform some simple operations with it. The example I've written takes a mosaic dataset -&amp;gt; looks for all the images within a specified month -&amp;gt; checks their mean value -&amp;gt; and exports the image with the maximum mean value (attached file). However, I didn't figure out how to do the same starting with the image service. In the data types of the arctoolbox there is a type DEImageServer, but I can't apply the function&amp;nbsp; arcpy.da.SearchCursor to it. So I have to convert somehow the service to a mosaic I guess? Any ideas how? Or should the approach be totally different?&lt;/P&gt;&lt;P&gt;The reason why we do that is that not all of the users have the access to the original data, so we want them to take the image service and then proceed with whatever they are doing.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;execute(self, parameters, messages):&lt;BR /&gt;    &lt;SPAN&gt;"""The source code of the tool."""&lt;BR /&gt;&lt;/SPAN&gt;    in_mosaic = parameters[&lt;SPAN&gt;0&lt;/SPAN&gt;].valueAsText&lt;BR /&gt;    in_month = parameters[&lt;SPAN&gt;1&lt;/SPAN&gt;].valueAsText&lt;BR /&gt;    output_folder = parameters[&lt;SPAN&gt;2&lt;/SPAN&gt;].valueAsText&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;# find all the rasters taken within the month identified in the input and check their average value of all cells.&lt;BR /&gt;&lt;/SPAN&gt;    my_mosaic = os.path.normpath(in_mosaic)&lt;BR /&gt;    mean_month = {}&lt;BR /&gt;    &lt;SPAN&gt;with &lt;/SPAN&gt;arcpy.da.SearchCursor(my_mosaic, [&lt;SPAN&gt;'OBJECTID'&lt;/SPAN&gt;, &lt;SPAN&gt;'FILE_DATE'&lt;/SPAN&gt;]) &lt;SPAN&gt;as &lt;/SPAN&gt;cursor:&lt;BR /&gt;        &lt;SPAN&gt;for &lt;/SPAN&gt;row &lt;SPAN&gt;in &lt;/SPAN&gt;cursor:&lt;BR /&gt;            month = row[&lt;SPAN&gt;1&lt;/SPAN&gt;].date().month&lt;BR /&gt;            &lt;SPAN&gt;if &lt;/SPAN&gt;int(month) == int(in_month):&lt;BR /&gt;                raster = str(my_mosaic) + &lt;SPAN&gt;'/Raster.OBJECTID =' &lt;/SPAN&gt;+ str(row[&lt;SPAN&gt;0&lt;/SPAN&gt;])&lt;BR /&gt;                arcpy.CalculateStatistics_management(raster)&lt;BR /&gt;                mean_value = arcpy.GetRasterProperties_management(in_raster=raster, property_type=&lt;SPAN&gt;'MEAN'&lt;/SPAN&gt;)&lt;BR /&gt;                arcpy.AddMessage(mean_value)&lt;BR /&gt;                mean_month[row[&lt;SPAN&gt;0&lt;/SPAN&gt;]] = mean_value&lt;BR /&gt;    &lt;SPAN&gt;del &lt;/SPAN&gt;cursor&lt;BR /&gt;    objectid_max_mean = max(mean_month.iteritems(), key=operator.itemgetter(&lt;SPAN&gt;1&lt;/SPAN&gt;))[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;    arcpy.AddMessage(objectid_max_mean)&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;#Save the raster with the maximum mean value&lt;BR /&gt;&lt;/SPAN&gt;    where_clause = &lt;SPAN&gt;"OBJECTID ="  &lt;/SPAN&gt;+ str(objectid_max_mean)&lt;BR /&gt;    arcpy.management.ExportMosaicDatasetItems(my_mosaic, output_folder, &lt;SPAN&gt;""&lt;/SPAN&gt;, where_clause, &lt;SPAN&gt;'TIFF'&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;, &lt;SPAN&gt;"NONE"&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 11:38:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113552#M6</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T11:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113582#M7</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/468635"&gt;@OlgaKoblet&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would start with analyzing the image service properties and fields.&amp;nbsp; Your search cursor for the mosaic dataset uses text but it could be different with the published image service.&amp;nbsp; After you determine what the field type is, you may be able to use the same script with different field type parameters.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 13:06:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113582#M7</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-03T13:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113630#M8</link>
      <description>&lt;P&gt;Thank you for your message! You mean that I should look for another arcpy function that accesses image service fields?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113630#M8</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T15:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113631#M9</link>
      <description>&lt;P&gt;First you need to bring the image service into your ArcMap or Pro and view the attributes and fields.&amp;nbsp; Make sure the field types are the same as the mosaic dataset.&amp;nbsp; Then you may have to alter the python script to update that field type.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:27:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113631#M9</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-03T15:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113635#M10</link>
      <description>&lt;P&gt;The image service is already published, and the fields are the same as in the mosaic dataset that was published, but how to access them programmatically? Basically how to iterate through an image service?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:39:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113635#M10</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T15:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113638#M11</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/468635"&gt;@OlgaKoblet&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What platform?&amp;nbsp; ArcMap or ArcGIS Pro?&amp;nbsp; Also what version?&amp;nbsp; This will greatly affect the mode and type of script.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:42:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113638#M11</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-03T15:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113649#M12</link>
      <description>&lt;P&gt;forgot to tag you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/486546"&gt;@ABishop&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:55:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113649#M12</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T15:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113651#M13</link>
      <description>&lt;P&gt;ArcGIS Pro, 2.8&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:56:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113651#M13</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T15:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113652#M14</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/468635"&gt;@OlgaKoblet&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you be able to share your service with me for testing?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 15:58:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113652#M14</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-03T15:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113654#M15</link>
      <description>&lt;P&gt;Wouldn't it be the same for every image service? Just going through the table and collecting the OBJECTIDs in a list, for example?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 16:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113654#M15</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T16:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113655#M16</link>
      <description>&lt;P&gt;I am not sure without seeing the data.&amp;nbsp; But here is some information with python snippets:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/data-access-using-cursors.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/data-access-using-cursors.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything else I find is suggesting the use of iterators in Model Builder here:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/iterate-row-selection.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/modelbuilder-toolbox/iterate-row-selection.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 16:04:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113655#M16</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-03T16:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113659#M17</link>
      <description>&lt;P&gt;Just to be sure: the attached script works without any problems, but if I am to change the input of the function&amp;nbsp;&lt;SPAN&gt;arcpy.da.SearchCursor from mosaic to image service, it doesn't work anymore since this function takes as input only a feature class, layer, table, or table view. Meaning that I either have to convert the image service prior to this step or use some other function for iterating through the image service.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 16:10:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113659#M17</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-03T16:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113694#M18</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/468635"&gt;@OlgaKoblet&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the input feature, try pasting the image service URL.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 17:03:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113694#M18</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-11-03T17:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113971#M19</link>
      <description>&lt;P&gt;Mit der URL geht es auch nicht. Vielleicht wäre Python API eine bessere Option?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="OlgaKoblet_0-1636016065554.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/26804i238D7D9C6A39A233/image-size/medium?v=v2&amp;amp;px=400" role="button" title="OlgaKoblet_0-1636016065554.png" alt="OlgaKoblet_0-1636016065554.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 08:54:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1113971#M19</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-04T08:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1114987#M20</link>
      <description>&lt;P&gt;olga,&lt;/P&gt;&lt;P&gt;There is no simple arcpy solution for this workflow at the moment.&lt;/P&gt;&lt;P&gt;We will need to take advantages of image service rest apis for some of the operations. (or using equivalent arcgis python apis)&lt;/P&gt;&lt;P&gt;For instance, you may use image service "query" operation to get item info to loop through them; you may use image service "compute statistics and histograms" operation to figure out the statistics of them.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm" target="_blank"&gt;https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.raster.toc.html#imagerylayer" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.raster.toc.html#imagerylayer&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not arcpy? - still using the compute stats as an example, I think&amp;nbsp;arcpy will try to write it back to data, you cannot do it with image service for now. theoretically, you can only do it when you are the admin/publisher of a service.&lt;/P&gt;&lt;P&gt;zikang&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 18:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1114987#M20</guid>
      <dc:creator>Zikang</dc:creator>
      <dc:date>2021-11-08T18:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1116005#M21</link>
      <description>&lt;P&gt;thank you for your message? Do you know if I can just select rasters in the image service (not in the mosaic as I do) based on some attribute, and then export them locally? May be calculating statistics is not a good example. Basically doing in arcpy the manuall steps of selecting the rows in the attribute table of the footprints and then doing "selection -&amp;gt; create layer from selected features".&lt;/P&gt;&lt;P&gt;The limitation (for us) of the ArcGIS API for python is that the services need to be in portal, and not just on the server.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 13:13:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1116005#M21</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-11T13:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Working in arctoolbox directly with an image service</title>
      <link>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1116006#M22</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1496"&gt;@PeterBecker&lt;/a&gt;&amp;nbsp; may be you have ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 13:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-image-server-questions/working-in-arctoolbox-directly-with-an-image/m-p/1116006#M22</guid>
      <dc:creator>OlgaKoblet</dc:creator>
      <dc:date>2021-11-11T13:15:45Z</dc:date>
    </item>
  </channel>
</rss>

