<?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: Change pixel values using the nearest neighbor value in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38311#M477</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure what you want for the nearest value&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 2&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;4 -1 -9999&lt;/P&gt;&lt;P&gt;7&amp;nbsp; 8&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;nearest value by distance? (ie .... 4)&lt;/LI&gt;&lt;LI&gt;average value in the NSEW axis exclusive of -9999? (not implemented in Arc*)&lt;/LI&gt;&lt;LI&gt;average value in the 8 neighbours exclusive of -9999 (implemented in Arc&lt;/LI&gt;&lt;LI&gt;weighted average by value and distance? (not implemented in Arc*&lt;/LI&gt;&lt;LI&gt;average in the row progressive direction?&amp;nbsp; (coincidently gives the same value as distance)&lt;/LI&gt;&lt;LI&gt;average in the column progressive direction (ie filter down columns, answer 2)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 can be don't by producing a mean raster, then using its value in the Con statement&lt;/P&gt;&lt;P&gt;'raster' == -1, 'mean_raster', raster in pseudo code&lt;/P&gt;&lt;P&gt;1, 2, 5 and 6 can be done with numpy &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jul 2016 15:28:22 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-07-14T15:28:22Z</dc:date>
    <item>
      <title>Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38308#M474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone. I am having some trouble when I convert the raster properties because I am using the resample tool to change the resolution and the number of columns/rows to match with another raster, so I can combine them after the conversion. However, after using the tool, the raster doesn't match, which was expected because some values were created to change its resolution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I came up with the following idea, I can Extract by Mask using the original file as mask and those values I don't want in my output I can try to change them getting the nearest neighbor value; however, I didn't find one tool that could do that for me. In addition, I tried Majority Filter, but it changes values that I don't want to change and also do not eliminate all unwanted values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The grid below is just an example of my whole grid and what I am trying to do is substitute the -1 values with the nearest value except for the -9999 (NoData value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 0.48 1.16 1.9 
0.28 1.02 1.53 
1.82 2.08 1.86 
0.16 2.42 2.14 
 2.41 2.43 2.1 
 2.45 2.44 2.43
6 2.55 2.45 2.4
2.59 2.59 2.56 
2.61 -1 -1 -9999
67 2.66 2.63 -1
2.79 2.79 2.79 
 2.85 2.83 2.82
0.88 2.84 -1 -1 &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is welcome and I have some knowledge with python too, if that would be that only option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:29:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38308#M474</guid>
      <dc:creator>AlexandreAssunção</dc:creator>
      <dc:date>2021-12-10T21:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38309#M475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think Con has been mentioned to you before, which can be done in the raster calculator of with the Con tool.&amp;nbsp; Just query the raster for values equal to -1, assign those locations/values some other value, then keep the remaining values intact.&lt;/P&gt;&lt;P&gt;The exact syntax depends on which approach you are using, in pseudo code,&lt;/P&gt;&lt;P&gt;'raster' == -1, 'value if true', 'value if 'false'&lt;/P&gt;&lt;P&gt;'raster' == -1, -88, 'raster'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:06:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38309#M475</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-14T15:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38310#M476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But as you can see, there are different values that -1 has to be switched with. The way you stated all -1 values will be replaced to the true statement and it's not what I want here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:15:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38310#M476</guid>
      <dc:creator>AlexandreAssunção</dc:creator>
      <dc:date>2016-07-14T15:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38311#M477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure what you want for the nearest value&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 2&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;4 -1 -9999&lt;/P&gt;&lt;P&gt;7&amp;nbsp; 8&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;nearest value by distance? (ie .... 4)&lt;/LI&gt;&lt;LI&gt;average value in the NSEW axis exclusive of -9999? (not implemented in Arc*)&lt;/LI&gt;&lt;LI&gt;average value in the 8 neighbours exclusive of -9999 (implemented in Arc&lt;/LI&gt;&lt;LI&gt;weighted average by value and distance? (not implemented in Arc*&lt;/LI&gt;&lt;LI&gt;average in the row progressive direction?&amp;nbsp; (coincidently gives the same value as distance)&lt;/LI&gt;&lt;LI&gt;average in the column progressive direction (ie filter down columns, answer 2)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 can be don't by producing a mean raster, then using its value in the Con statement&lt;/P&gt;&lt;P&gt;'raster' == -1, 'mean_raster', raster in pseudo code&lt;/P&gt;&lt;P&gt;1, 2, 5 and 6 can be done with numpy &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:28:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38311#M477</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-14T15:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38312#M478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ps for resampling, use nearest neighbour or majority ... if you don't want your values to change, then you wouldn't have this problem &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/resample.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/resample.htm"&gt;Resample—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and if it is a float raster you are trying to resample, scale up by a factor of 10, take the integer of that, do the NN or majority resample, convert back to float&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:35:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38312#M478</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-14T15:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38313#M479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used Resample Tool with nearest neighboor. The problem is I am trying to create new rows and columns to match the other raster. I have a 516 x 510 raster and I am trying to convert it to 1024x1024. Some values will be created and I have no control about it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:46:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38313#M479</guid>
      <dc:creator>AlexandreAssunção</dc:creator>
      <dc:date>2016-07-14T15:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38314#M480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I would say the number one. Or if it is possible do the same thing as the Majority Filter Tool does but just for the -1 values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 15:47:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38314#M480</guid>
      <dc:creator>AlexandreAssunção</dc:creator>
      <dc:date>2016-07-14T15:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38315#M481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use resampling with nearest neighbor.... there should be no new values introduced to the raster&lt;/P&gt;&lt;P&gt;if there are, stop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;start with resampled raster,&amp;nbsp; call this raster0&lt;/LI&gt;&lt;LI&gt;query the resampled raster ( using con),&amp;nbsp; so that -1 is assigned nodata.... call this raster1&lt;/LI&gt;&lt;LI&gt;run the majority filter on raster1 (no data and the former -1 will be ignored in the calculations... call this 'filtered'&lt;/LI&gt;&lt;LI&gt;use a Con statement to replace the -1 values in raster0 with those in 'filtered'&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;you should be done.&lt;/P&gt;&lt;P&gt;As an alternative, arrays can be used to simplify this if you have too many classes to deal with in a simple con statement or multiple nested boolean or's and/or and's&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 16:27:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38315#M481</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-14T16:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change pixel values using the nearest neighbor value</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38316#M482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your raster is DEM?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 20:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/change-pixel-values-using-the-nearest-neighbor/m-p/38316#M482</guid>
      <dc:creator>AbdullahAnter</dc:creator>
      <dc:date>2016-07-14T20:48:26Z</dc:date>
    </item>
  </channel>
</rss>

