<?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: Query a raster for pixel value from ImageServer/AGOL in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052258#M6520</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For creating layer in memory look here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/making-a-group-layer-or-layer-in-memory/m-p/730303" target="_self"&gt;https://community.esri.com/t5/arcgis-pro-sdk-questions/making-a-group-layer-or-layer-in-memory/m-p/730303&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get pixel value from layer:&lt;/P&gt;&lt;P&gt;var raster = imageServiceLayer.GetRaster();&lt;/P&gt;&lt;P&gt;object pixelValue = raster.GetPixelValue(0, 150000, 150000);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Apr 2021 13:58:09 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2021-04-28T13:58:09Z</dc:date>
    <item>
      <title>Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052150#M6516</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a raster published in AGOL and it’s URL is like this &lt;A href="https://tiledimageservices1.arcgis.com/IB7Kf2F8K18M2LKr/arcgis/rest/services/AE000S000_020M6871P01M000/ImageServer" target="_blank"&gt;https://tiledimageservices1.arcgis.com/IB7Kf2F8K18M2LKr/arcgis/rest/services/fooRaster/ImageServer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to access the raster via the Pro SDK but &lt;STRONG&gt;NOT&lt;/STRONG&gt; add it to the map, and the only example code I can find is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string dataSoureUrl = @”&lt;A href="https://tiledimageservices1.arcgis.com/IB7Kf2F8K18M2LKr/arcgis/rest/services/AE000S000_020M6871P01M000/ImageServer" target="_blank"&gt;https://tiledimageservices1.arcgis.com/IB7Kf2F8K18M2LKr/arcgis/rest/services/fooRaster/ImageServer&lt;/A&gt;”;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ImageServiceLayer rasterLayer = null;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;await QueuedTask.Run(() =&amp;gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a layer based on the url. In this case the layer we are creating is an image service layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rasterLayer = (ImageServiceLayer)LayerFactory.Instance.CreateLayer(new Uri(dataSoureUrl), myMap);&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason I don’t want to add it to the map – is because I am doing a “drill down” on about 10 rasters based on an x,y coordinate the user has selected on the map (with some background mapping of the world) – and extract the pixel value at that coordinate. It’s too much unnecessary overhead to load the rasters into Pro and do the analysis after the event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to query a pixel value in memory based on the an x,y location??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 10:46:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052150#M6516</guid>
      <dc:creator>Vidar</dc:creator>
      <dc:date>2021-04-28T10:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052258#M6520</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For creating layer in memory look here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/making-a-group-layer-or-layer-in-memory/m-p/730303" target="_self"&gt;https://community.esri.com/t5/arcgis-pro-sdk-questions/making-a-group-layer-or-layer-in-memory/m-p/730303&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get pixel value from layer:&lt;/P&gt;&lt;P&gt;var raster = imageServiceLayer.GetRaster();&lt;/P&gt;&lt;P&gt;object pixelValue = raster.GetPixelValue(0, 150000, 150000);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 13:58:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052258#M6520</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-04-28T13:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052657#M6527</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your reply - I think the LayerParams only works with feature data, not rasters.&amp;nbsp; But the second part of your reply looks good.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 12:00:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052657#M6527</guid>
      <dc:creator>Vidar</dc:creator>
      <dc:date>2021-04-29T12:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052695#M6528</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;What about this workaround?&lt;/P&gt;&lt;H3&gt;Create FeatureLayer and set to not display in Map.&lt;/H3&gt;&lt;DIV class="highlight highlight-source-cs"&gt;&lt;PRE&gt;&lt;SPAN class="pl-c"&gt;//The catalog path of the feature layer to add to the map&lt;/SPAN&gt;
&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; &lt;SPAN class="pl-en"&gt;featureClassUriVisibility&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;new&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;Uri&lt;/SPAN&gt;(&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;@"&lt;/SPAN&gt;C:\Data\Admin\AdminData.gdb\USA\cities&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;);
&lt;SPAN class="pl-c"&gt;//Define the Feature Layer's parameters.&lt;/SPAN&gt;
&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; &lt;SPAN class="pl-en"&gt;layerParamsVisibility&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;new&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;FeatureLayerCreationParams&lt;/SPAN&gt;(&lt;SPAN class="pl-smi"&gt;featureClassUriVisibility&lt;/SPAN&gt;)
{
  &lt;SPAN class="pl-c"&gt;//Set visibility&lt;/SPAN&gt;
  &lt;SPAN class="pl-smi"&gt;IsVisible&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-c1"&gt;false&lt;/SPAN&gt;,
};
&lt;SPAN class="pl-c"&gt;//Create the layer with the feature layer parameters and add it to the active map&lt;/SPAN&gt;
&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; &lt;SPAN class="pl-en"&gt;createdFC&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-smi"&gt;LayerFactory&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;Instance&lt;/SPAN&gt;.&lt;SPAN class="pl-en"&gt;CreateLayer&lt;/SPAN&gt;&amp;lt;&lt;SPAN class="pl-k"&gt;FeatureLayer&lt;/SPAN&gt;&amp;gt;(&lt;SPAN class="pl-smi"&gt;layerParamsVisibility&lt;/SPAN&gt;, &lt;SPAN class="pl-smi"&gt;MapView&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;Active&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;Map&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 13:46:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052695#M6528</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-04-29T13:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052703#M6529</link>
      <description>&lt;P&gt;I think thats the same sort of solution in the link provided before - again, its dealing with FeatureLayers - but here we are dealing with rasters, specifically ImageServer. Also the example adds it to the map which I don't really want to do.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 13:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052703#M6529</guid>
      <dc:creator>Vidar</dc:creator>
      <dc:date>2021-04-29T13:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052706#M6530</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I have checked right now. It works. Code below:&lt;/P&gt;&lt;P&gt;var imageServiceUriVisibility = new Uri(path);&lt;/P&gt;&lt;P&gt;var layerParamsVisibility = new LayerCreationParams(imageServiceUriVisibility)&lt;BR /&gt;{&lt;BR /&gt;//Set visibility&lt;BR /&gt;IsVisible = false,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// Creates a layer based on the url. In this case the layer we are creating is an image service layer.&lt;BR /&gt;imageServiceLayer = LayerFactory.Instance.CreateLayer&amp;lt;ImageServiceLayer&amp;gt;(layerParamsVisibility, MapView.Active.Map);&lt;BR /&gt;if (imageServiceLayer == null)&lt;BR /&gt;{&lt;BR /&gt;ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + path);&lt;BR /&gt;return null;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 13:59:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052706#M6530</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-04-29T13:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052709#M6531</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It looks&amp;nbsp; like Pro only adds layer with unchecked visibility checkbox, I understand&amp;nbsp; that it does not show in TOC.&lt;/P&gt;&lt;P&gt;Sorry. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:05:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052709#M6531</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-04-29T14:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052712#M6532</link>
      <description>&lt;P&gt;It does work, I've tried it too - unfortunately it adds it to the map. Maybe I'll have to work with this until there is a better solution from ESRI.&lt;/P&gt;&lt;P&gt;Thanks for your help on this though.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:08:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1052712#M6532</guid>
      <dc:creator>Vidar</dc:creator>
      <dc:date>2021-04-29T14:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Query a raster for pixel value from ImageServer/AGOL</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1054557#M6552</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Is there anyone from ESRI who can give an official line on this &lt;/STRONG&gt;- at the moment my add-in behaviour is horrible and clunky -&amp;nbsp;I am having to add 10 rasters to my map before I can do my queries which is taking an inordinate amount of time and it looks clunky to the user. Plus I have to clean up and remove the layers after I have queried my rasters. It's just not an acceptable user experience.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 08:32:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/query-a-raster-for-pixel-value-from-imageserver/m-p/1054557#M6552</guid>
      <dc:creator>Vidar</dc:creator>
      <dc:date>2021-05-05T08:32:47Z</dc:date>
    </item>
  </channel>
</rss>

