<?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 Get imagery samples from imagery layer with raster function applied in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/get-imagery-samples-from-imagery-layer-with-raster/m-p/812301#M2515</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I encountered a problem while attempting to use the &lt;EM&gt;get_samples&lt;/EM&gt; method of the Imagery Layer from the Python API.&lt;/P&gt;&lt;P&gt;I accessed the Landsat Imagery layer, applied the &lt;EM&gt;NDVI&lt;/EM&gt; raster function, but the &lt;EM&gt;get_samples &lt;/EM&gt;method does not return the correct values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import arcgis&lt;/P&gt;&lt;P&gt;from arcgis.raster.functions import *&lt;/P&gt;&lt;P&gt;from arcgis.geocoding import geocode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;## skipped connection lines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# access Landsat Imagery&lt;/P&gt;&lt;P&gt;landsat_item = gis.content.search('Multispectral Landsat', 'Imagery Layer', outside_org=True)[0]&lt;/P&gt;&lt;P&gt;landsat = landsat_item.layers[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Create geometry&lt;/P&gt;&lt;P&gt;area = geocode('Bucharest, RO', out_sr=landsat.properties.spatialReference)[0]&lt;/P&gt;&lt;P&gt;geom = arcgis.geometry.Geometry(area['extent'])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Get samples&lt;/P&gt;&lt;P&gt;ndvi_lyr = ndvi(landsat, '5 4')&lt;BR /&gt;sam = ndvi_lyr.get_samples(geom, sample_count=1)&lt;BR /&gt;sam[0]['value']&amp;nbsp; # get only the pixel values&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;DIV class=""&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;'1405 1198 1012 927 1367 1146 857 9 2720'&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;P&gt;I expected to get the values as NDVI values (-1 to +1 interval), not unprocessed data.&lt;/P&gt;&lt;P&gt;Am I doing something wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;BR /&gt;Alin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2018 12:11:09 GMT</pubDate>
    <dc:creator>AlinPlesoianu3</dc:creator>
    <dc:date>2018-09-17T12:11:09Z</dc:date>
    <item>
      <title>Get imagery samples from imagery layer with raster function applied</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/get-imagery-samples-from-imagery-layer-with-raster/m-p/812301#M2515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I encountered a problem while attempting to use the &lt;EM&gt;get_samples&lt;/EM&gt; method of the Imagery Layer from the Python API.&lt;/P&gt;&lt;P&gt;I accessed the Landsat Imagery layer, applied the &lt;EM&gt;NDVI&lt;/EM&gt; raster function, but the &lt;EM&gt;get_samples &lt;/EM&gt;method does not return the correct values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import arcgis&lt;/P&gt;&lt;P&gt;from arcgis.raster.functions import *&lt;/P&gt;&lt;P&gt;from arcgis.geocoding import geocode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;## skipped connection lines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# access Landsat Imagery&lt;/P&gt;&lt;P&gt;landsat_item = gis.content.search('Multispectral Landsat', 'Imagery Layer', outside_org=True)[0]&lt;/P&gt;&lt;P&gt;landsat = landsat_item.layers[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Create geometry&lt;/P&gt;&lt;P&gt;area = geocode('Bucharest, RO', out_sr=landsat.properties.spatialReference)[0]&lt;/P&gt;&lt;P&gt;geom = arcgis.geometry.Geometry(area['extent'])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Get samples&lt;/P&gt;&lt;P&gt;ndvi_lyr = ndvi(landsat, '5 4')&lt;BR /&gt;sam = ndvi_lyr.get_samples(geom, sample_count=1)&lt;BR /&gt;sam[0]['value']&amp;nbsp; # get only the pixel values&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;DIV class=""&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;'1405 1198 1012 927 1367 1146 857 9 2720'&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;P&gt;I expected to get the values as NDVI values (-1 to +1 interval), not unprocessed data.&lt;/P&gt;&lt;P&gt;Am I doing something wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;BR /&gt;Alin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 12:11:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/get-imagery-samples-from-imagery-layer-with-raster/m-p/812301#M2515</guid>
      <dc:creator>AlinPlesoianu3</dc:creator>
      <dc:date>2018-09-17T12:11:09Z</dc:date>
    </item>
  </channel>
</rss>

