<?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 Strange Con behaviour: unable to produce false condition after Extract by Mask in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515520#M7389</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've encountered some odd behaviour with the Con tool that I can't seem to work o.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have one input landcover classification raster. I then want to combine two classes within it, that is then divided by whether or not they lie within a road buffer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, using an arcpy script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- I create a mask from the original raster that simply contains 1 values for the original combined classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- use Extract by Mask to create a second mask that only contains 1's where the combined classes are overlapped by road buffer polygons&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- reinsert that into the original raster with a new value (let's say 15) using the Con tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when I do this final step I end up with an output raster that only contains these 15 pixels and NoData everywhere else. eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# inputs in_ras = r"C:\test\landcover.gdb\lcc" # input landcover classification raster road_buffer = r"C:\test\landcover.gdb\buffer700" # road buffer polygon layer&amp;nbsp; arcpy.Raster(in_ras)&amp;nbsp; # combine two classes from input raster into a mask combined = arcpy.sa.Con((in_ras == 2) | (in_ras == 13), 1)&amp;nbsp; # extract pixels in the combined mask that lie within the road_buffer into a new mask combined_road_buff = arcpy.sa.ExtractByMask(combined, road_buffer)&amp;nbsp; # create output raster with the new class as 15, and the original raster everywhere else out_ras = arcpy.sa.Con(combined_road_buff == 1, 15, in_ras)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now for whatever reason (and I've tested this manually using the raster calculator too), the final output raster is basically a mask of the new class with NoData everywhere else (ie identical to combined_road_buff). I tested using a constant value as the false condition instead of a raster and I get the same result. Yet changing the final Con operation to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;out_ras = arcpy.sa.Con(arcpy.sa.IsNull(combined_road_buff), in_ras, 15)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; gives the desired result, with the new class combined with the original classification.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone advise on what is going on here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(and if anyone has a more efficient way to do what I'm doing, feel free to point it out!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Malcolm&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 02 Feb 2014 23:20:31 GMT</pubDate>
    <dc:creator>MalcolmNunn</dc:creator>
    <dc:date>2014-02-02T23:20:31Z</dc:date>
    <item>
      <title>Strange Con behaviour: unable to produce false condition after Extract by Mask</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515520#M7389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've encountered some odd behaviour with the Con tool that I can't seem to work o.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have one input landcover classification raster. I then want to combine two classes within it, that is then divided by whether or not they lie within a road buffer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, using an arcpy script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- I create a mask from the original raster that simply contains 1 values for the original combined classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- use Extract by Mask to create a second mask that only contains 1's where the combined classes are overlapped by road buffer polygons&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- reinsert that into the original raster with a new value (let's say 15) using the Con tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when I do this final step I end up with an output raster that only contains these 15 pixels and NoData everywhere else. eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# inputs in_ras = r"C:\test\landcover.gdb\lcc" # input landcover classification raster road_buffer = r"C:\test\landcover.gdb\buffer700" # road buffer polygon layer&amp;nbsp; arcpy.Raster(in_ras)&amp;nbsp; # combine two classes from input raster into a mask combined = arcpy.sa.Con((in_ras == 2) | (in_ras == 13), 1)&amp;nbsp; # extract pixels in the combined mask that lie within the road_buffer into a new mask combined_road_buff = arcpy.sa.ExtractByMask(combined, road_buffer)&amp;nbsp; # create output raster with the new class as 15, and the original raster everywhere else out_ras = arcpy.sa.Con(combined_road_buff == 1, 15, in_ras)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now for whatever reason (and I've tested this manually using the raster calculator too), the final output raster is basically a mask of the new class with NoData everywhere else (ie identical to combined_road_buff). I tested using a constant value as the false condition instead of a raster and I get the same result. Yet changing the final Con operation to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;out_ras = arcpy.sa.Con(arcpy.sa.IsNull(combined_road_buff), in_ras, 15)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; gives the desired result, with the new class combined with the original classification.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone advise on what is going on here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(and if anyone has a more efficient way to do what I'm doing, feel free to point it out!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Malcolm&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Feb 2014 23:20:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515520#M7389</guid>
      <dc:creator>MalcolmNunn</dc:creator>
      <dc:date>2014-02-02T23:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Strange Con behaviour: unable to produce false condition after Extract by Mask</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515521#M7390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Malcolm,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your second statement using the IsNull tool treats the NoData cells appropriately. NoData is handled differently by many tools, and normally results in NoData in your output. So although you think the Con statement results in either True or False, it also has a hidden case NoData. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I recommend you to read the Help Topic on "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018700000003000000" rel="nofollow" target="_blank"&gt;NoData and how it affects analysis&lt;/A&gt;&lt;SPAN&gt;" which explains this behavior.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 08:05:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515521#M7390</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-02-05T08:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Strange Con behaviour: unable to produce false condition after Extract by Mask</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515522#M7391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right you are! It does make sense now, thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Malcolm&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 22:47:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/strange-con-behaviour-unable-to-produce-false/m-p/515522#M7391</guid>
      <dc:creator>MalcolmNunn</dc:creator>
      <dc:date>2014-02-05T22:47:48Z</dc:date>
    </item>
  </channel>
</rss>

