<?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: Rasters, cell size and projections in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687653#M53244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, the &lt;A href="https://community.esri.com/space/2145" target="_blank"&gt;Python&lt;/A&gt;​ place is meant for using Python in the ArcGIS Platform. If you would like to use ArcGIS your could use something like this (will require ArcGIS and Spatial Analyst extension, see &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/spatial-analyst-toolbox/focal-statistics.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/spatial-analyst-toolbox/focal-statistics.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Focal Statistics—Help | ArcGIS for Desktop&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
from arcpy.sa import *
ws = r"path to the folder were the TIFF files reside"
ras_name_in = "MDT200-TARRAGONA-H311.tif"
ras_name_out = "resultRasterTarragona.tif"

ras_in = arcpy.Raster(os.path.join(ws, ras_name_in))
arcpy.CheckOutExtension("Spatial")

ras_sum = FocalStatistics(ras_in, NbrRectangle(3, 3, "CELL"), "SUM", "DATA")

# please note that less than and greater than may level each other out
ras_out = (ras_sum - ras_in) - (ras_in * 8)
ras_out.save(os.path.join(ws, ras_name_out))

# maybe you're just interested in the standard deviation (STD)

arcpy.CheckInExtension("Spatial")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For non ArcGIS solutions you can better post your question elsewhere. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:55:36 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-12T04:55:36Z</dc:date>
    <item>
      <title>Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687644#M53235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two questions about rasters:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1- I created a raster doing some operation with rasters using python. I used a raster of 200 x 200 meters of cell size. Once I got the final raster, when I chech its properties the cell size is 1x1. What does it mean?? Is the final raster 1x1 m o 200x200 m??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2- When I am doing the python code I define a raster projection (In this case ED 50 Zone 31) but when I load to arcgis It is not the same with other layers with this projection. I am trying to project the spatial reference, but it does not work... Any help???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your attention!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2015 07:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687644#M53235</guid>
      <dc:creator>LlorençCastell_Fabregues</dc:creator>
      <dc:date>2015-10-04T07:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687645#M53236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what were the operations?&lt;/P&gt;&lt;P&gt;was the data in the correct coordinate system first?&amp;nbsp; just defining it won't make it so.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2015 11:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687645#M53236</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-10-04T11:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687646#M53237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The operations were the sum of the differences among one pixl and the 8 neighbors.&lt;/P&gt;&lt;P&gt;Tthe data was in the same coordinate system. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you think?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2015 16:26:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687646#M53237</guid>
      <dc:creator>LlorençCastell_Fabregues</dc:creator>
      <dc:date>2015-10-04T16:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687647#M53238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan has some valid points.&amp;nbsp; To help troubleshoot this, can you provide some more detail on what you did?&amp;nbsp; You can upload screenshots if that is easiest.&amp;nbsp; You can also post your code, which would be of great help in troubleshooting.&amp;nbsp; To keep it formatted correctly, see this post:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris Donohue, GISP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2015 16:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687647#M53238</guid>
      <dc:creator>ChrisDonohue__GISP</dc:creator>
      <dc:date>2015-10-04T16:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687648#M53239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think some additional information would be welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can your provide more details about your the environment settings: &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/python/using-environment-settings.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/python/using-environment-settings.htm"&gt;Using environment settings in Python—Help | ArcGIS for Desktop&lt;/A&gt; . Also the place were you are running your code (stand alone or in the Python Window of ArcGIS is important. If you run your code in the Python Window inside ArcMap (or ArcGIS Pro), and you don't set any geoprocessing environment settings in your code, the geoprocessing environment settings from your ArcMap session will be taken.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The coordinate system of the input rasters has no effect over the output pixel size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some operations that will result in a raster with a different cell size (like &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/resample.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/resample.htm"&gt;Resample—Help | ArcGIS for Desktop&amp;nbsp; &lt;/A&gt;and &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/spatial-analyst-toolbox/aggregate.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/spatial-analyst-toolbox/aggregate.htm"&gt;Aggregate—Help | ArcGIS for Desktop&lt;/A&gt; ), but by default the Raster Analysis Cell Size setting is "Maximum of Inputs" (which means that it will take the largest cell size of all inputs and use that size for the output).&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Oct 2015 18:22:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687648#M53239</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-10-04T18:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687649#M53240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is the code comented yesterday. Any help!?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;IMG alt="screenshot.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/129683_screenshot.png" style="width: 620px; height: 322px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 12:33:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687649#M53240</guid>
      <dc:creator>LlorençCastell_Fabregues</dc:creator>
      <dc:date>2015-10-05T12:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687650#M53241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be more helpful if you would follow the suggestion by &lt;A href="https://community.esri.com/migrated-users/84114"&gt;Chris Donohue&lt;/A&gt; on &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't seem to use any ArcGIS (arcpy) components. Is there any particular reason why you post your questions at GeoNet?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 13:08:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687650#M53241</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-10-05T13:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687651#M53242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't use ARCGIS components because I don't know them, I am starting with python. I use python to get a raster to work in arcgis. For this Iam writting here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 13:16:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687651#M53242</guid>
      <dc:creator>LlorençCastell_Fabregues</dc:creator>
      <dc:date>2015-10-05T13:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687652#M53243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you Know any raster function to uses in python?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 13:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687652#M53243</guid>
      <dc:creator>LlorençCastell_Fabregues</dc:creator>
      <dc:date>2015-10-05T13:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687653#M53244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, the &lt;A href="https://community.esri.com/space/2145" target="_blank"&gt;Python&lt;/A&gt;​ place is meant for using Python in the ArcGIS Platform. If you would like to use ArcGIS your could use something like this (will require ArcGIS and Spatial Analyst extension, see &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/spatial-analyst-toolbox/focal-statistics.htm" title="http://desktop.arcgis.com/en/desktop/latest/tools/spatial-analyst-toolbox/focal-statistics.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Focal Statistics—Help | ArcGIS for Desktop&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
from arcpy.sa import *
ws = r"path to the folder were the TIFF files reside"
ras_name_in = "MDT200-TARRAGONA-H311.tif"
ras_name_out = "resultRasterTarragona.tif"

ras_in = arcpy.Raster(os.path.join(ws, ras_name_in))
arcpy.CheckOutExtension("Spatial")

ras_sum = FocalStatistics(ras_in, NbrRectangle(3, 3, "CELL"), "SUM", "DATA")

# please note that less than and greater than may level each other out
ras_out = (ras_sum - ras_in) - (ras_in * 8)
ras_out.save(os.path.join(ws, ras_name_out))

# maybe you're just interested in the standard deviation (STD)

arcpy.CheckInExtension("Spatial")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For non ArcGIS solutions you can better post your question elsewhere. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:55:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687653#M53244</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T04:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687654#M53245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should learn...unless you want to replicate a whole world of moving and block window functions on your own.&amp;nbsp; Your kernel window and its python implementation will take forever on a moderate sized raster, so unless you are using very small arrays for demonstration-educational purposes, you might want to investigate&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;using the functions implemented in ArcGIS&lt;/LI&gt;&lt;LI&gt;using numpy and/or scipy functions and not coding in pure python.&lt;/LI&gt;&lt;LI&gt;using tools in an open source GIS (which you appear to have access to)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Oct 2015 21:20:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687654#M53245</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-10-05T21:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687655#M53246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These links are related &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/166213"&gt;Terrain Ruggedness Index Phyton code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The advice there about using ArcGIS functionality also applies here &lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Oct 2015 03:54:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687655#M53246</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-10-06T03:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rasters, cell size and projections</title>
      <link>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687656#M53247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for the help. I will try it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2015 15:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rasters-cell-size-and-projections/m-p/687656#M53247</guid>
      <dc:creator>LlorençCastell_Fabregues</dc:creator>
      <dc:date>2015-10-07T15:15:52Z</dc:date>
    </item>
  </channel>
</rss>

