<?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: How to set the spatial reference when saving raster function output? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012857#M5368</link>
    <description>&lt;P&gt;Which probably means you arent using Pro 2.7 or didn't do a&lt;/P&gt;&lt;P&gt;&amp;gt; conda update arcgis&lt;/P&gt;&lt;P&gt;through conda or the package manager.&lt;/P&gt;&lt;P&gt;More details...&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/guide/install-and-set-up/#Get-Conda-with-Anaconda-for-Python-Distribution" target="_blank"&gt;ArcGIS API For Python | ArcGIS for Developers&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Dec 2020 12:13:49 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-12-30T12:13:49Z</dc:date>
    <item>
      <title>How to set the spatial reference when saving raster function output?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012789#M5363</link>
      <description>&lt;P&gt;Can I reproject the output of a raster function before saving it to a GIS?&lt;/P&gt;&lt;P&gt;For example, this code applies an agricultural mask to a burnt area.&lt;/P&gt;&lt;P&gt;burnt_areas_masked = colormap(set_null(rasters=[ag_mask, burnt_areas]),&lt;BR /&gt;colormap=[[4, 115, 76, 0],&lt;BR /&gt;[3, 168, 112, 0],&lt;BR /&gt;[2, 230, 152, 0],&lt;BR /&gt;[1, 255, 170, 0]])&lt;/P&gt;&lt;P&gt;The inputs 'ag_mask' and 'burnt_areas' are in-memory rasters generated by raster functions applied to imagery layer items in the GIS.&amp;nbsp; The output 'burnt_areas_mask' inherits the spatial reference of 'ag_mask'.&amp;nbsp; I guess this makes sense since 'ag_mask' is the first raster in the list of inputs.&amp;nbsp; But 'ag_mask' is only a boolean layer and not actual the input data.&amp;nbsp; So I need a way to set the spatial reference of the output 'burnt_areas_mask' to the spatial reference of 'burnt_areas'.&lt;/P&gt;&lt;P&gt;The "reproject" function looks like a possible solution.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.raster.functions.html#reproject" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.raster.functions.html#reproject&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But I get a "name error" when I try to call it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="reproject.PNG" style="width: 616px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/2945i8F7D096E48B25DC9/image-size/large?v=v2&amp;amp;px=999" role="button" title="reproject.PNG" alt="reproject.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 23:47:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012789#M5363</guid>
      <dc:creator>DavidJohnson5</dc:creator>
      <dc:date>2020-12-29T23:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the spatial reference when saving raster function output?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012795#M5365</link>
      <description>&lt;P&gt;Don't do the * import thing until you check&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis.raster.functions as arf
dir(arf)
[... 'reproject', ...]

# ---- then arf.reproject(....&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 30 Dec 2020 00:59:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012795#M5365</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-30T00:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the spatial reference when saving raster function output?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012834#M5367</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;reproject function was added only in V1.8.3. Please check if you are using an older version.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="method1.JPG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/2960i63584EA69C107422/image-size/medium?v=v2&amp;amp;px=400" role="button" title="method1.JPG" alt="method1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;You can also try using out_spatial_reference env variable&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="method2.JPG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/2961iF8BFE60ED5337E6F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="method2.JPG" alt="method2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 07:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012834#M5367</guid>
      <dc:creator>Rhea_Jackson</dc:creator>
      <dc:date>2020-12-30T07:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the spatial reference when saving raster function output?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012857#M5368</link>
      <description>&lt;P&gt;Which probably means you arent using Pro 2.7 or didn't do a&lt;/P&gt;&lt;P&gt;&amp;gt; conda update arcgis&lt;/P&gt;&lt;P&gt;through conda or the package manager.&lt;/P&gt;&lt;P&gt;More details...&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/guide/install-and-set-up/#Get-Conda-with-Anaconda-for-Python-Distribution" target="_blank"&gt;ArcGIS API For Python | ArcGIS for Developers&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 12:13:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1012857#M5368</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-30T12:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the spatial reference when saving raster function output?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1013049#M5372</link>
      <description>&lt;P&gt;I should have mentioned that I'm using ArcGIS Online Notebooks.&amp;nbsp; I'm not sure what version of the API it uses.&amp;nbsp; But it must be an earlier version since reproject is not available.&amp;nbsp; I tried your second suggestion Rhea to set the out_spatial_reference property and that worked.&amp;nbsp; Thanks Dan and Rhea for the quick responses!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 20:35:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1013049#M5372</guid>
      <dc:creator>DavidJohnson5</dc:creator>
      <dc:date>2020-12-30T20:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the spatial reference when saving raster function output?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1013076#M5373</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/161208"&gt;@DavidJohnson5&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
arcgis.__version__
'1.8.3'&lt;/LI-CODE&gt;&lt;P&gt;for version number&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 22:25:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-set-the-spatial-reference-when-saving/m-p/1013076#M5373</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-30T22:25:42Z</dc:date>
    </item>
  </channel>
</rss>

