<?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: export raster as stretched value from model builder in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765409#M3688</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you would execute this in the Python window, you could use the raster properties min and max of the raster like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;result = arcpy.sa.Int((arcpy.Raster('DTM_50cm') - arcpy.Raster('DTM_50cm').minimum) / (arcpy.Raster('DTM_50cm').maximum - arcpy.Raster('DTM_50cm').minimum) * 255)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result may differ from the original stretch result, since stretching normally cuts of a percentage from start and end to optimize the stretch range.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Feb 2016 17:28:42 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2016-02-15T17:28:42Z</dc:date>
    <item>
      <title>export raster as stretched value from model builder</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765407#M3686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i'm trying to export a raster with its stretched values (0-255) and i can't figure out how to do it via the model builder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;normally this can be achieved by&lt;/P&gt;&lt;P&gt;right clicking the raster in the Table Of Contents&lt;/P&gt;&lt;P&gt;Data &amp;gt; Export Data...&lt;/P&gt;&lt;P&gt;Tick the "Use Renderer" box&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how would i achieve this using the model builder?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2015 16:56:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765407#M3686</guid>
      <dc:creator>jamiefinney</dc:creator>
      <dc:date>2015-11-24T16:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: export raster as stretched value from model builder</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765408#M3687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The method you use from the GUI is not exposed in modelbuilder. You would have to calculate a new raster with the stretch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are some notes I had written to myself:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;You have a raster and you want to stretch the values into a different range. For example you have an elevation grid which ranges from 1 to 1000 but you want to stretch this into a grid ranging from 1 to 10. This is different to using the standard Reclassify tool as this would lump them into classes.&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;In a nutshell you convert you existing raster values to a proportion between 0 and 1 then alter the proportion value by a scalar.&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;In the example above we type the following into a raster calculator (remember to substitute the words with values):&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;(([EleGrid] - eleMin) / eleRange) * newRange ) + newMin&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;[EleGrid] = is the grid name, in this example assumed to be an elevation grid&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;eleMin = is the minimum value in your original grid, in this example 1&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;eleRange = is the range of values in your original grid, in this example 1000 - 1 = 999&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;newRange = is the range in your desired stretch, in this example 10 - 1 = 9&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;newMin = is the minimum value in your desired stretch value, in this example 1&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;so what you actually type into a raster calculator is:&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; font-size: 12px; font-family: verdana, sans-serif; color: #333333;"&gt;&lt;EM&gt;(([EleGrid] - 1) / 999) * 9 ) + 1&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 16:00:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765408#M3687</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2016-02-15T16:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: export raster as stretched value from model builder</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765409#M3688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you would execute this in the Python window, you could use the raster properties min and max of the raster like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;result = arcpy.sa.Int((arcpy.Raster('DTM_50cm') - arcpy.Raster('DTM_50cm').minimum) / (arcpy.Raster('DTM_50cm').maximum - arcpy.Raster('DTM_50cm').minimum) * 255)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result may differ from the original stretch result, since stretching normally cuts of a percentage from start and end to optimize the stretch range.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 17:28:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/export-raster-as-stretched-value-from-model/m-p/765409#M3688</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-02-15T17:28:42Z</dc:date>
    </item>
  </channel>
</rss>

